Does the following code will compile if both classes are declared in Test.java?
//Test.java
public class Car{
public String myCar = "Ferrari" ;
}
public class Test{
public static void main(String ... args){
Car myCar = new Car();
System.out.println(myCar.myCar);
}
}
Login in to like
Login in to comment