Вы находитесь на странице: 1из 5

dev#321#D

public class dd
{
static Runnable r=new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
try
{
Thread.sleep(1000);
}catch (InterruptedException e) {
// TODO: handle exception
System.out.println("interrupted");
}
System.out.println("ran");
}
};
public static void main(String args[]) throws InterruptedException
{
Thread t=new Thread(r);
t.start();
System.out.println("started");
t.sleep(2000);
System.out.println("interrupting");
t.interrupt();
System.out.println("ended");
}
}
-------------------------------------------public class dd
{
public static void go(short n)
{
System.out.println("short");
}
public static void go(Short n)
{
System.out.println("Short");
}
public static void go(Long n)
{
System.out.println("Long");
}
public static void main(String args[]) throws InterruptedException
{
Short y=6;
int z=7;
go(y);
go(z);
}
}compilation fails
----------------------------------------------------------------------public class dd
{
public static void main(String args[]) throws InterruptedException
{

Sente a=new Sente();


a.go();
Goban b=new Goban();
b.go();
Stone c=new Stone();
c.go();
}
}
class Sente implements go
{
public void go()
{
System.out.println("Go in SENTE");
}
}
class Goban implements go
{
public void go()
{
System.out.println("Go in Goban");
}
}
class Stone extends Goban implements go
{
}
interface go
{
public void go();
}
--------------------------------------------abstract class A
{
abstract void a1();
void a2(){};
}
class B extends A
{
void a1(){};
void a2(){};
}
public class dd extends B
{
void c1(){}
public static void main(String args[])
{
A x=new B();
dd y=new dd();
A z=new dd();
y.c1();
z.a1();
x.a1();
}
}
--------------------------------------

class A

{
void process() throws Exception
{
throw new Exception();
}
}
class dd extends A
{
void process()
{
System.out.println("Go in Goban");
}
public static void main(String args[])
{
new dd().process();
}
}
-----------------------------------------------------------interface Foo
{
int bar();
}
public class dd
{
class a implements Foo
{
public int bar()
{
return 1;
}
}
public int fubar(Foo foo)
{
return foo.bar();
}
public void testfoo()
{
class a implements Foo
{
public int bar()
{
return 2;
}
}
System.out.println(fubar(new a()));
}
public static void main(String args[])
{
new dd().testfoo();
}
}
---------------------------------------------------------------class c
{
public String value;
public String getvalue()
{

return "Class C";


}
}
class b
{
public c c;
public String getvalue()
{
return c.getvalue();
}
}
public class dd
{
public void methoda(){
b b=new b();
b.getvalue();
}
public static void main(String args[])
{
dd a=new dd();
a.methoda();
}
}
----------------------------------------------------------------------public class dd {
public static
public static
public static
public static
short y = 6;
long z = 7;
go(y);
go(z);
}
}

void
void
void
void

go(Long n) {System.out.print("Long ");}


go(Short n) {System.out.print("Short ");}
go(int n) {System.out.print("int ");}
main(String [] args) {

int long
-----------------------------------------import java.util.Scanner;
public class dd {
public static void main(String [] args) {
Scanner sc=new Scanner("one,5,true,3,true,6,7,false");
sc.useDelimiter(",");
while(sc.hasNext())
{
if(sc.hasNextBoolean())
{
System.out.println(sc.nextBoolean());
}
else
sc.next()
;
}
}

----------------------------------------------------------------------enum x{
Earth,wind,
Fire{
public String info(){return "hot";}
};
public String info()
{
return "element";
}
}
---------------------------------------------------------------------public class dd {
private HashMap<String, Integer> map=new HashMap<String, Integer
>();
public void put(String name,int value)
{
map.put(name, value);
}
public Set<String> gn()
{
return map.keySet();
}
public static void main(String [] args) {
}
}
----------------------------------------------------------------------------------

Вам также может понравиться