Java程序辅导

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

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
Introduction to Java
Assignment
CS 180
Sunil Prabhakar
Department of Computer Science 
Purdue University
Q1
Which of the following is a legal Java 
declaration for an identifier?
A. 3.116PI
B. new
C. happy-hour
D. demolition Derby
E. DOUBTFUL
2
Q2
Which of the following is not a legal Java 
identifier?
A. MyRegistration1
B. my_1Registration
C. myRegistration1
D. 1myRegistration
E. $myRegistration$
3
Q3 
Which of the following will not be treated as 
comments by the Java compiler?
4
/* I hope this is 
   part of the comment 
*/
A
/* I hope this is 
   part of the 
comment /*
B
// I hope this is 
   //part of the 
// comment /*
C
// I hope this is 
   //part of the 
/* comment /*
D
/* I hope this is 
   /* part of the comment */
 
*/
E
Q4
5
import javax.swing.*;
class HelloWorld { 
 public static void main(String[ ] args) {
 JFrame MyWindow;
 myWindow = new JFrame( );
 MyWindow.setSize(300, 200);
 }
}
Why won't this code 
compile?
A. MyWindow is an illegal 
identifier
B. myWindow is not 
declared
C. setTitle() is not called
D. Looks like it will 
compile.
Q5
6
import javax.swing.*;
class HelloWorld { 
 public static void main(String[ ] args) {
 JFrame myWindow, firstName;
 firstName = new String( );
firstName = new JFrame( );
}
}
Why won't this code 
compile?
A. firstName can't be used 
as an identifier for a 
JFrame object
B. myWindow is not used 
in the program
C. firstName can't be 
assigned a String object
D. This should compile.