I\'m following the CS106A lectures online. I\'m going through the code on Lecture 12, but it\'s giving me errors in Eclipse.
This is my code. It seems the error is beca
string[] args in main method is used to follow the prototype defined by the technology. If you dont used it then JVM will considered it as a simple method. Also as this is prototype then remember technology used 0 byte of an array. for ex:
class MainDemo{
public static void main(){
System.out.println("I am main method without arg");
}
public static void main(String[] args){
main(); //As method is static so no need to create an object
System.out.println("MainDemo");
}
}
O/p for above will give:
I am main method without arg
MainDemo
Regarding your code, you cannot define/declare any method inside main method. Use it outside main method but within class.