Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
Lab 2 Pre-Lab 
 
The following exercises must be completed before you come to lab.  Your 
instructor will check your pre-lab exercises at the beginning of the lab 
period.  Completion of the pre-lab is worth 10 points of the total 50 points 
for the lab. 
 
1. Put the following statements in the right order to complete the java class 
resulting in the given output.  You will need to provide the necessary curly 
braces and indenting.  (Note:  your name should be replaced with your 
actual name) 
  System.out.print("\nGoodbye!"); 
  System.out.println("Welcome to Java programming!"); 
public static void main(String[] args) 
System.out.print("Success!\n"); 
  public class FirstClass 
  System.out.println(“Java rules!”); 
System.out.print("My name is your name.\n"); 
 
 Expected Output 
  Welcome to Java programming! 
          Java rules! 
  My name is your name. 
  Success! 
 
  Goodbye! 
 Note:  You will test this part in lab. 
 
2. Study the following program and show what it will print on the screen. 
 public class Age 
 { 
  public static void main(String[] args) 
  { 
   int age; 
   age = 12; 
   System.out.println("The age is "); 
   System.out.println(age); 
  } 
 }