Course Hero Logo

According to my knowledge we cannot execute without a

Course Hero uses AI to attempt to automatically extract content from documents to surface to you and others so you can study better, e.g., in search results, to enrich docs, and more. This preview shows page 9 - 12 out of 33 pages.

According to my knowledgewecannot executewithoutamain methodbecause whenyour running thejava program.javaVirtual machine look for themain method.ifJVMcouldnot find themain methoditwillshow you run time error Exception inthreadmain couldnot find themainclass.
What if the static modifier is removed from the signature of the main method?
What is difference between static (class) method and instance method?
What is method overloading?
Argument lists could differ in –1. Number of parameters.2. Data type of parameters.3. Sequence of Data type of parameters.Method overloadingis also known asStatic Polymorphism.Why method overloading is not possible by changing the return type in java?A method cannot be overloaded on the bases of return types because the compiler willcheck only the name of the method and the arguments.So a method cannot be overloadedon the bases of return types.Can we overload main() method?Yes, youcan overload main method in Java. you have to call theoverloaded mainmethodfrom the actualmain method. yeswe can overload main method.mainmethodmust not be staticmain method.publicclassTest{puba licstaticvoidmain(String[]args){System.out.println("main(String[] args)");}publicstaticvoidmain(Stringarg1){System.out.println("main(String arg1)");}publicstaticvoidmain(Stringarg1,Stringarg2){System.out.println("main(String arg1, String arg2)");}}What is ‘this’ in java?
publicclassMyThisTest{privateinta;publicMyThisTest(){this(42);// calls the other constructor}publicMyThisTest(inta){this.a=a;// assigns the value of the parameter a to the field of the same name}publicvoidfrobnicate(){inta=1;System.out.println(a);

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 33 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Spring
Professor
MeganE.Hartley
Tags

Newly uploaded documents

Show More

Newly uploaded documents

Show More

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture