Win a copy of High Performance Python for Data Analytics this week in the Python forum!

Tia Ko

Greenhorn
+ Follow
since Jan 31, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Tia Ko

The code will compile just fine and print - In first main()

Having two main methods is allowed as long as they are properly overloaded (yup, thats whts happening here - overloading of main ). The JVM will obviously only invoke the correct main method (with String array as an argument).
Yup, one can do the following:
a) Increase the accessibility of the method
b) Reduce the number of exception thrown
In line 2, a new object is created (even though the string literal "may" is present in the pool) and is returned to the reference variable s1. Thus, the variables s and s1 refer to different objects and the == operation returns a value false.