Quote (Trev @ Sep 18 2014 02:40pm)
Also what does this mean?"You will only need to program an application with a public static void main(String[] args) method" Does this mean only program with one main, or does that mean for what Labatymo put, i just insert that into the public class main?
I'd have to see the assignment, but I guess your teacher just wants to start off simple by creating a main class with 2 sub-classes and a main method.
Code
public class Main {
static class Robot {
private String name;
public Robot( String name ) {
this.name = name;
}
public String getName( ) {
return name;
}
public void setName( String name ) {
this.name = name;
}
}
static class Human {
private String name;
public Human( String name ) {
this.name = name;
}
public String getName( ) {
return name;
}
public void setName( String name ) {
this.name = name;
}
}
public static void main( String[] args ) {
Robot robot = new Robot( "T1000" );
Human human = new Human( "Bob" );
}
}
or he could mean literally declare 2 abstract Objects called human and robot
Code
public static void main(String[] args){
Object robot;
Object human;
}