Java第一周作业
1.输出学号班级和姓名
1 package chap1; 2 3 public class TestHello { 4 5 public static void main(String[] args) { 6 // TODO Auto-generated method stub 7 System.out.println("193230508"); 8 System.out.println("计算机1905"); 9 System.out.println("耿小泷"); 10 11 } 12 13 }
2.输出以下图形
*
***
*****
***
*
1 package chap1; 2 3 public class TestHello { 4 5 public static void main(String[] args) { 6 // TODO Auto-generated method stub 7 System.out.println(" *\n"+" ***\n"+"*****\n"+" ***\n"+" *\n"); 8 9 } 10 11 }
3.定义两个整型变量a=5 b=8 求平方和并输出
1 package chap1; 2 3 public class TestHello { 4 5 public static void main(String[] args) { 6 // TODO Auto-generated method stub 7 int a=5; 8 9 int b=8; 10 11 System.out.println(a*a+b*b); 12 13 } 14 15 }