1
public class test1 {
public static void main(String[] args){
System.out.println("Welcome to Java");
System.out.println("Welcome to Computer Science");
System.out.println("Programming is fun");
}
}
2
public class test2 {
public static void main(String[] arg){
for(int i=0;i<5;i++)
System.out.println("Welcome to Java");
}
}
3
public class test3 {
public static void main(String[] arg) {
System.out.println(" J A V V A");
System.out.println(" J A A V V A A");
System.out.println(" J J A A A A A V V A A A A A ");
System.out.println(" J J A A V A A");
}
}
4
public class test4 {
public static void main(String[] args) {
System.out.println("a a^2 a^3");
System.out.println("1 1 1");
System.out.println("2 4 8");
System.out.println("3 9 27");
System.out.println("4 16 64");
}
}
5
public class test5 {
public static void main(String[] args) {
double a;
a=(9.5*4.5-2.5*3)/(45.5-3.5);
System.out.println(a);
}
}
6
public class test6 {
public static void main(String[] args) {
int sum=0;
for(int i=1;i<=9;i++)
sum+=i;
System.out.println(sum);
}
}
7
public class test7 {
public static void main(String[] args) {
double a,b;
a=4*(1.0-1.0/3+1.0/5-1.0/7+1.0/9-1.0/11);
b=4*(1.0-1.0/3+1.0/5-1.0/7+1.0/9-1.0/11+1.0/13);
System.out.println(a);
System.out.println(b);
}
}
8
public class test8 {
public static void main(String[] args) {
double Length,Area;
Length=Math.PI*2*5.5;
Area=Math.PI*5.5*5.5;
System.out.println("半径为5。5的周长和面积分别为"+Length+","+Area);
}
}
9
public class test9 {
public static void main(String[] args) {
double Length,Area;
Length=2*4.5*7.9;
Area=4.5*7.9;
System.out.println("宽度为4.5,高度为7.9的矩形的面积和周长分别为"+Area+","+Length);
}
}
10
public class test10 {
public static void main(String[] args) {
double time=45.5/60;
double s=14.0/1.6;
double v=s/time;
System.out.println(v);
}
}
11
public class test11 {
public static void main(String[] args) {
double s1,s2,s3,s4,s5;
s1=312032486+365*24*60*60/7+365*24*60*60/45-365*24*60*60/13;
s2=s1+365*24*60*60/7+365*24*60*60/45-365*24*60*60/13;
s3=s2+365*24*60*60/7+365*24*60*60/45-365*24*60*60/13;
s4=s3+365*24*60*60/7+365*24*60*60/45-365*24*60*60/13;
s5=s4+365*24*60*60/7+365*24*60*60/45-365*24*60*60/13;
System.out.println("未来第1年的人口数为:"+s1);
System.out.println("未来第2年的人口数为:"+s2);
System.out.println("未来第3年的人口数为:"+s3);
System.out.println("未来第4年的人口数为:"+s4);
System.out.println("未来第5年的人口数为:"+s5);
}
}
12
public class test12 {
public static void main(String[] args) {
double time=1+(35.0/60+40)/60.0;
double s=24*1.6;
double v=s/time;
System.out.println(v);
}
}
13
public class test13 {
public static void main(String[] args) {
double x,y;
x=(44.5*0.55-50.2*5.9)/(3.4*0.55-50.2*2.1);
y=(3.4*5.9-44.5*2.1)/(3.4*0.55-50.2*2.1);
System.out.println("x="+x+","+"y="+y);
}
}