Name Lau Name CSE 110 Lab 2 Introduction to variables Lab Ex
Solution
Answer - 1
1.
Whenever a java file contains a public class then it is necessary that the java file and
public class should have same name, otherwise compiler will reports an error.
For your example error massage should as follows -
java: class Helo is public, should be declared in a file named Helo.java
2.
It will not generate any error as Java compiler does not report any spelling mistake.
3.
Compiler will generate three errors specifying -
i> unclosed string literal
ii> expected \';\'
iii> reached en of file while parsing
4.
Compiler will generate following errors -
i> expected \')\'
ii> unclosed string literal
iii> not a statement
5.
Compiler will generate an error - \';\' expected
