title: questions i tripped on in an interview
body: <p>i was asked a few java interview questions which i had no idea how solve could use some answers</p>
  
  <ol>
  <li><p>write a method which takes an int so the method would be </p>
  
  <p>public void somemethd(int i){}</p>
  
  <p>Now if i=1 then it should print true and if i=2 it should print false
  but you cannot use any conditional operators nor can you use if or switch</p></li>
  <li><p>how do two threads pass data in between each other, like let lets say you start 2 threads and you want to make one thread make the other thread wait.
  he rephrased the question to make it simpler, what if i have a varible in 1 thread and i want to send it to another thread how to do that.</p></li>
  <li><p>what if there is a non static method in base class and you make it a static method in derived class, would you get the same error as if u has a static method in base and u try to make it non static in derived class</p></li>
  <li><p>what is the use of overloading other than same name for different method?
  (i guess i should have said constructor overloading but it just didnt come to me, is there anything else)</p></li>
  <li><p>the syntax is not correct but u can jus assume everything is fine </p>
  
  <p><pre><code></p>
  
  <p>class base{</p>
  
  <p>show(){</p>
  
  <p>this.mymethod();
  }</p>
  
  <p>mymethod(){
  /...
  }
  }</p>
  
  <p>class derived extends base{</p>
  
  <pre><code>show(){
  
  super.mymethod();
  }
  
  mymethod(){
  /...
  }
  }
  </code></pre></li>
  </ol>
  
  <p>now what happens when i do the following</p>
  
  <p>a. </p>
  
  <pre><code>base b = new derived();
  
     b.show(); 
  </code></pre>
  
  <p>b. </p>
  
  <pre><code>derived d= new base();
  
     d.show();
  </code></pre>
  
  <p>c. what if there was no show method in base n i did</p>
  
  <pre><code> base b = new derived();
  
     b.show(); 
  </code></pre>
  
  <p>d. what if there was no show method in base n i did</p>
  
   derived d= new base();
  
     d.show();
  </code></pre>