import
java.util.
*
;
import java.io. * ;
/** */ /**A class comment*/
public class Test
{
/**//*
public static void main(String[] args)
{
double i = 0;
while(i<0.99d)
{
i = Math.random();
System.out.println(i);
}
}*/
/**//*
public static void main(String[] args)
{
for(int i=0;i<128;i++)
if(Character.isLowerCase((char)i))
System.out.println("value:"+i+"char:"+(char)i);
}*/
/**//*
public static void main(String[] args)
{
for(int i=1,j=i+10;i<5;i++,j=i*2)
{
System.out.println("i="+i+"j="+j);
}
}*/
public static void main(String[] args)
{
//new BreakAndContinue();
//new LableFor();
//new SwitchTest();
/**//*
OverLoading ol = new OverLoading();
ol.testConstVal();
ol.testChar();
ol.testByte();
ol.testShort();
ol.testInt();
ol.testLong();
ol.testFloat();
ol.testDouble();*/
/**//*
ThisTest1 tt = new ThisTest1();
tt.increment().increment().increment().increment().print();*/
//ThisTest2 tt = new ThisTest2();
/**//*
Bath b = new Bath();
System.out.println(b);*/
/**//*
Detergent d = new Detergent();
d.dilute();d.apply();d.scrub();d.foam();
System.out.println(d);
System.out.println("Testing base class");*/
//Cartoon c = new Cartoon();
//Chess c = new Chess();
//PlaceSetting ps = new PlaceSetting(2);
//CADSystem cs = new CADSystem(8);
/**//*
Bart b = new Bart();
b.doh(1);
b.doh('x');
b.doh(1.0f);
b.doh(new Milhouse());*/
/**//*
Orc o = new Orc("bulktree",23);
System.out.println(o);
o.change("oakertree",22);
System.out.println(o);*/
//Beetle b = new Beetle();
/**//*
RandomShapeGenerator rsg = new RandomShapeGenerator();
Shape[] s = new Shape[9];
for(int i=0;i<s.length;i++)
s[i] = rsg.next();
for(int i=0;i<s.length;i++)
s[i].draw();*/
/**//*
Instrument[] i = new Instrument{
new Wind(),
new Percussion(),
new Stringed(),
new Brass(),
new WoodWind()
};*/
//new Sandwich();
/**//*
System.out.println(RandVals.randomInt);
System.out.println(RandVals.randomLong);
System.out.println(RandVals.randomFloat);
System.out.println(RandVals.randomDouble);*/
/**//*
A a = new A();
A a2 = new A();
a2.receiveD(a.getD());*/
/**//*
Parcel1 p = new Parcel1();
p.ship("xiangtan");
p.ship("湘潭");*/
/**//*
Parcel2 p = new Parcel2();
p.ship("湘潭");
Parcel2 q = new Parcel2();
Parcel2.Contents c = q.getContents();
Parcel2.Destination d = q.getDestination("南方");
d.readLabel();*/
/**//*
MNA mna = new MNA();
mna.f();
MNA.A mnaa = mna.new A();
mnaa.g();
MNA.A.B mnaab = mnaa.new B();
mnaab.h();*/
/**//*
WithInner wi = new WithInner();
InheritInner ii = new InheritInner(wi);*/
/**//*
Callee1 c1 = new Callee1();
Callee2 c2 = new Callee2();
MyIncrement.f(c2);
Caller caller1 = new Caller(c1);
Caller caller2 = new Caller(c2.getCallbackReference());
caller1.go();
caller1.go();
caller2.go();
caller2.go();*/
/**//*
try
{
ExtraFeatures.f();
}
catch(MyException e)
{
e.printStackTrace();
}
try
{
ExtraFeatures.g();
}
catch(MyException e)
{
e.printStackTrace();
}
try
{
ExtraFeatures.h();
}
catch(MyException e)
{
e.printStackTrace();
System.out.println("e.val()="+e.val());
}*/
//new ArraySize();
/**//*
new IceCream();
for(int i=0;i<20;i++)
System.out.println("flavorSet("+i+")=");
String[] f1 = flavorSet(flavors.length);
for(int j=0;j<fl.length;j++)
System.out.println("\t"+f1[j]);*/
/**//*
System.out.println(PrintCollection.fill(new ArrayList()));
System.out.println(PrintCollection.fill(new HashSet()));
System.out.println(PrintCollection.fill(new HashMap()));*/
//new FillingLists();
/**//*
List list = new ArrayList();
for(int i=0;i<3;i++)
{
list.add(new Hamster(i));
System.out.println(list.iterator().next());
}*/
//new SimpleCollection();
/**//*
try
{
new IOStreamDemo();
}
catch(IOException e)
{
e.printStackTrace();
}*/
try
{
new StreamTest();
}
catch(IOException e)
{
System.out.println(e);
}
}
}
/**/ /*
class BreakAndContinue
{
BreakAndContinue()
{
for(int i=0;i<100;i++)
{
if(i==74)
break;
if(i%9!=0)
continue;
System.out.println("i="+i);
}
int i = 0;
while(true)
{
i++;
int j = i*27;
if(j==1269)
break;
if(i%10!=0)
continue;
System.out.println("i="+i);
}
}
}*/
/**/ /*
class LableFor
{
LableFor()
{
int i=0;
outer:
for(;true;)
{
inner:
for(;i<10;i++)
{
System.out.println("i="+i);
if(i==2)
{
System.out.println("continue");
continue;
}
if(i==3)
{
System.out.println("break");
i++;
break;
}
if(i==7)
{
System.out.println("continue outer");
i++;
continue outer;
}
if(i==8)
{
System.out.println("break outer");
break outer;
}
for(int k=0;k<5;k++)
{
if(k==3)
{
System.out.println("continue inner");
continue inner;
}
}
}
}
}
}*/
/**/ /*
class SwitchTest
{
SwitchTest()
{
for(int i=0;i<100;i++)
{
char c = (char)(Math.random()*26+'a');
System.out.println(c+":");
switch(c)
{
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
System.out.println("vowel");
break;
case 'y':
case 'w':
System.out.println("sometime a vowel");
break;
default:
System.out.println("consonant");
}
}
}
}*/
/**/ /*
class OverLoading
{
void f1(char x)
{
System.out.println("f1(char)");
}
void f1(byte x)
{
System.out.println("f1(byte)");
}
void f1(short x)
{
System.out.println("f1(short)");
}
import java.io. * ;
/** */ /**A class comment*/
public class Test
{
/**//*
public static void main(String[] args)
{
double i = 0;
while(i<0.99d)
{
i = Math.random();
System.out.println(i);
}
}*/
/**//*
public static void main(String[] args)
{
for(int i=0;i<128;i++)
if(Character.isLowerCase((char)i))
System.out.println("value:"+i+"char:"+(char)i);
}*/
/**//*
public static void main(String[] args)
{
for(int i=1,j=i+10;i<5;i++,j=i*2)
{
System.out.println("i="+i+"j="+j);
}
}*/
public static void main(String[] args)
{
//new BreakAndContinue();
//new LableFor();
//new SwitchTest();
/**//*
OverLoading ol = new OverLoading();
ol.testConstVal();
ol.testChar();
ol.testByte();
ol.testShort();
ol.testInt();
ol.testLong();
ol.testFloat();
ol.testDouble();*/
/**//*
ThisTest1 tt = new ThisTest1();
tt.increment().increment().increment().increment().print();*/
//ThisTest2 tt = new ThisTest2();
/**//*
Bath b = new Bath();
System.out.println(b);*/
/**//*
Detergent d = new Detergent();
d.dilute();d.apply();d.scrub();d.foam();
System.out.println(d);
System.out.println("Testing base class");*/
//Cartoon c = new Cartoon();
//Chess c = new Chess();
//PlaceSetting ps = new PlaceSetting(2);
//CADSystem cs = new CADSystem(8);
/**//*
Bart b = new Bart();
b.doh(1);
b.doh('x');
b.doh(1.0f);
b.doh(new Milhouse());*/
/**//*
Orc o = new Orc("bulktree",23);
System.out.println(o);
o.change("oakertree",22);
System.out.println(o);*/
//Beetle b = new Beetle();
/**//*
RandomShapeGenerator rsg = new RandomShapeGenerator();
Shape[] s = new Shape[9];
for(int i=0;i<s.length;i++)
s[i] = rsg.next();
for(int i=0;i<s.length;i++)
s[i].draw();*/
/**//*
Instrument[] i = new Instrument{
new Wind(),
new Percussion(),
new Stringed(),
new Brass(),
new WoodWind()
};*/
//new Sandwich();
/**//*
System.out.println(RandVals.randomInt);
System.out.println(RandVals.randomLong);
System.out.println(RandVals.randomFloat);
System.out.println(RandVals.randomDouble);*/
/**//*
A a = new A();
A a2 = new A();
a2.receiveD(a.getD());*/
/**//*
Parcel1 p = new Parcel1();
p.ship("xiangtan");
p.ship("湘潭");*/
/**//*
Parcel2 p = new Parcel2();
p.ship("湘潭");
Parcel2 q = new Parcel2();
Parcel2.Contents c = q.getContents();
Parcel2.Destination d = q.getDestination("南方");
d.readLabel();*/
/**//*
MNA mna = new MNA();
mna.f();
MNA.A mnaa = mna.new A();
mnaa.g();
MNA.A.B mnaab = mnaa.new B();
mnaab.h();*/
/**//*
WithInner wi = new WithInner();
InheritInner ii = new InheritInner(wi);*/
/**//*
Callee1 c1 = new Callee1();
Callee2 c2 = new Callee2();
MyIncrement.f(c2);
Caller caller1 = new Caller(c1);
Caller caller2 = new Caller(c2.getCallbackReference());
caller1.go();
caller1.go();
caller2.go();
caller2.go();*/
/**//*
try
{
ExtraFeatures.f();
}
catch(MyException e)
{
e.printStackTrace();
}
try
{
ExtraFeatures.g();
}
catch(MyException e)
{
e.printStackTrace();
}
try
{
ExtraFeatures.h();
}
catch(MyException e)
{
e.printStackTrace();
System.out.println("e.val()="+e.val());
}*/
//new ArraySize();
/**//*
new IceCream();
for(int i=0;i<20;i++)
System.out.println("flavorSet("+i+")=");
String[] f1 = flavorSet(flavors.length);
for(int j=0;j<fl.length;j++)
System.out.println("\t"+f1[j]);*/
/**//*
System.out.println(PrintCollection.fill(new ArrayList()));
System.out.println(PrintCollection.fill(new HashSet()));
System.out.println(PrintCollection.fill(new HashMap()));*/
//new FillingLists();
/**//*
List list = new ArrayList();
for(int i=0;i<3;i++)
{
list.add(new Hamster(i));
System.out.println(list.iterator().next());
}*/
//new SimpleCollection();
/**//*
try
{
new IOStreamDemo();
}
catch(IOException e)
{
e.printStackTrace();
}*/
try
{
new StreamTest();
}
catch(IOException e)
{
System.out.println(e);
}
}
}
/**/ /*
class BreakAndContinue
{
BreakAndContinue()
{
for(int i=0;i<100;i++)
{
if(i==74)
break;
if(i%9!=0)
continue;
System.out.println("i="+i);
}
int i = 0;
while(true)
{
i++;
int j = i*27;
if(j==1269)
break;
if(i%10!=0)
continue;
System.out.println("i="+i);
}
}
}*/
/**/ /*
class LableFor
{
LableFor()
{
int i=0;
outer:
for(;true;)
{
inner:
for(;i<10;i++)
{
System.out.println("i="+i);
if(i==2)
{
System.out.println("continue");
continue;
}
if(i==3)
{
System.out.println("break");
i++;
break;
}
if(i==7)
{
System.out.println("continue outer");
i++;
continue outer;
}
if(i==8)
{
System.out.println("break outer");
break outer;
}
for(int k=0;k<5;k++)
{
if(k==3)
{
System.out.println("continue inner");
continue inner;
}
}
}
}
}
}*/
/**/ /*
class SwitchTest
{
SwitchTest()
{
for(int i=0;i<100;i++)
{
char c = (char)(Math.random()*26+'a');
System.out.println(c+":");
switch(c)
{
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
System.out.println("vowel");
break;
case 'y':
case 'w':
System.out.println("sometime a vowel");
break;
default:
System.out.println("consonant");
}
}
}
}*/
/**/ /*
class OverLoading
{
void f1(char x)
{
System.out.println("f1(char)");
}
void f1(byte x)
{
System.out.println("f1(byte)");
}
void f1(short x)
{
System.out.println("f1(short)");
}