A
aks_java
Hi, I've built a GUI calculator and now my professor is asking the
following:
Prove the separation by having two “main” programs for the
calculator, one that calls the GUI version of the calculator, one that
calls a command line version of the calculator. The command line
version should have an interface that shows the current display
between square brackets, then a prompt (like the “>” sign) then awaits
your input. So a sample session should look something like :
[0.] > 78
[78.] > -
[78.] > 5
[5.] > =
[73.] > quit
Now here's my problem: How do I've two main methods in a single java
package ? I've looked around the internet to find examples of this
but I could find none that actually worked. Netbeans gives errors
straight away. I tried this for example:
class Checkmain{
public static void main(String args[]){
args[1]="ashish";
System.out.println("hello ");
}
}
class Checkmain1 extends Checkmain{
public static void main(String args[]){
System.out.println("how r u");
}
}
class Jo{
public static void main(String args[]){
String S[]=new String[10] ;
Checkmain.main(S);
Checkmain1.main(S);
}}
Now, I wonder if it is even possible to do this. How come no java book
talks about it ?
following:
Prove the separation by having two “main” programs for the
calculator, one that calls the GUI version of the calculator, one that
calls a command line version of the calculator. The command line
version should have an interface that shows the current display
between square brackets, then a prompt (like the “>” sign) then awaits
your input. So a sample session should look something like :
[0.] > 78
[78.] > -
[78.] > 5
[5.] > =
[73.] > quit
Now here's my problem: How do I've two main methods in a single java
package ? I've looked around the internet to find examples of this
but I could find none that actually worked. Netbeans gives errors
straight away. I tried this for example:
class Checkmain{
public static void main(String args[]){
args[1]="ashish";
System.out.println("hello ");
}
}
class Checkmain1 extends Checkmain{
public static void main(String args[]){
System.out.println("how r u");
}
}
class Jo{
public static void main(String args[]){
String S[]=new String[10] ;
Checkmain.main(S);
Checkmain1.main(S);
}}
Now, I wonder if it is even possible to do this. How come no java book
talks about it ?