Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
17 views

MCA Java Programming-Assignment1

The document discusses 10 code examples and whether they would compile and execute correctly. Code 1 and 4-10 would not compile due to incorrect syntax or usage of main method. Code 2 and 3 would compile but only code 3 would execute correctly with the main method defined properly as public, static and returning void.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

MCA Java Programming-Assignment1

The document discusses 10 code examples and whether they would compile and execute correctly. Code 1 and 4-10 would not compile due to incorrect syntax or usage of main method. Code 2 and 3 would compile but only code 3 would execute correctly with the main method defined properly as public, static and returning void.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Java Programming- Assignment 1

Specify whether the following code gets compiled and executed(ignore case)
1. Public class exercise1{ }

2. Public class exercise2{ System.out.println(hello); }

3. Public class exercise3{ Private static void main(String a[]){ System.out.println(hello); }

4. Public static void main(String a[]){ Main(a); }

5. Public class exercise4{ Public static void main(String a[]){ Main(a); }

6. Public class exercise5{ Public static int main(String a[]){ Return 0;

7. Public class exercise6{ Public static String main(String a[]){ String x=Hello; Return x; }

8.

Public class exercise7{ Public static String main(String a ){ }

9. Public class xyz{ Public static String main(){ }

10.Public class xyz{ String x=hello; Public static String main(String x ){ } }

You might also like