==========
package com.bar;
import com.foo.bar.blatz.*;
import com.foo.bar.*;
q 21,124
========
interface reloadable
{
public void reload90;
}
class edot
{
public void edit(){}
}
q113.244
============
import java.util.*;
public class numbernames
{
private hashmap<string,integer> map= new hashmap<string,integer>();
system.out.println(nn.getnames());
}
}
q 106
=========
import java.util.*;
class a{}
class b extends a{}
m1(lista);
m1(listb);
//m1(listo);
m2(lista);
//m2(listb);
m2(listo);
}
public static void m1(list<? extends a> list){}
public static void m2(list<a> list){}
q 42,177
========:
q 49,335
=========:
(temp=buffreader.readline())!=null
(ioexception e){
q 7,195
==========
import java.util.*;
public class x
{
public static void main(string[] args)
{
q 6,238
=========
import java.util.*;
public class numbernames1
{
public void takelist(list<? extends string> list)
{
//list.add("foo");
list=new arraylist<string>();
//list=new arraylist<object>();
string s=list.get(0);
object o=list;
}
}
q 12
========:
class alpha
{
public void foo(string... args)
{
system.out.println("alpha:foo");
}
public void bar(string a)
{
system.out.println("alpha:bar");
}
}
a.foo("test");b.foo("test");
a.bar("test");b.bar("test");
}
}
o/p
alpha:foo
beta:foo
beta:bar
beta:bar
q15
=====
enum element
{
earth,wind,fire{
public string info(){
return "hot";
}
};
q20
=======
package com.sun.cert;
import java.util.*;
public class addressbook
{
arraylist entries;
}
q52
=====
q 287,305
=========
public
private
public
public
public
public
q 246
======
import java.util.*;
system.out.println(list.get(0).length());
}
}
q243
=======
import java.util.*;
class animal{}
class dog extends animal{}
question # 187,248
====================
public class myint implements comparable {
------
}
public int compareto(object o) {
----
return i-i2.i;
}
explanation:
sort() method in collections class uses ompareto() method of comparable interface.
so we have to override that compareto() method. since the o/p should be in
ascending order, i-i2.i is returned.
question # 143
===============
protected single() { }
question # 5
=============
q;42
===========
q91,180
==========
public boolean doesfileexist(string []dirs,string filename)
{
string path="";
for(string dir:dirs)
{
q # 87
=========
pi is approximately 3.141593
q 139,288
===========
dog is-a animal
t.run();
t.join();
t.doit();
}
public void run()
{
system.out.println(" run. ");
}
public void doit()
{
system.out.println(" doit. ");
}
}
question # 220,323
=================
public class flags2
{
private boolean isready = false;
public synchronized void produce()
{
isready=true;
notifyall();
}
public synchronized void consume()
{
while(!isready)
{
try
{
wait();
}catch(exception ex){}
}
isready=false;//i think we must place "false" here....if we place "true" then
wait() method is never invoked again (isreday's value is always true)
}
}
question 5,353:
===========
public class gen<t> {
private t object;
public gen(t object) {
this.object=object;
}
public t getobject() {
return object;
}
question 6,238
===============
public void takelist(list<? extends string> list)
{
//list.add("foo");
list=new arraylist<string>(); // compiles
//list=new arraylist<object>();
string s=list.get(0); // compiles
object o=list; // compiles
}
qustion: 7
==============
import java.util.*;
public class x
{
public static void main(string[] args)
{
question 15:
============
enum element
{
earth,wind,fire{
public string info(){
return "hot";
}
};
public string info()
{
return "element";
}
}
question 20:
==============
package com.sun.cert;
import java.util.*;
public class addressbook
{
arraylist entries;
}
question 21:
============
interface reloadable
{
public void reload();
}
class edit
{
public void edit(){}
}
question 37
============
for(int x : y)
question 49,335
===============
(temp=buffreader.readline())!=null
(ioexception e){
question 12:
===============
alpha:foo beta:foo beta:bar beta:bar
question 52
===============
class a has name a
class b has name a
question 251,336
=============
import java.io.*
question 329,151
================
run() --->java.lang.thread
wait() --->java.lang.object
notify() --->java.lang.object
sleep() --->java.lang.thread
start() --->java.lang.thread
join() --->java.lang.thread
q200,313
============
public int update(int quantity, int adjust){
quantity=quantity + adjust;
return quantity;
int quant=100;
quant=update(quant,320);
system.out.println("quant="+quant;)
q-308
=============
public class doubler {
public static int doubleme(int h)
{
return h*2;
int amount=10;
public void doubleamount(amount);}
q-188,362
===============
java.util.sortedset->>>>>defines base methods fr an ordered set..