Hello fellows, i am absolute beginner to Java and just wanted to understand few things from the example was looking at...
public class House {
long propertyNumber;
String propertyType;
byte Stories;
public int Bedrooms;
double MarketValue;
}
public class Main {
public static void main(String[] args) {
House property = new House();
property.propertyNumber = 283795;
property.propertyType = "Single Family";
property.Bedrooms = 4;
property.MarketValue = 652880;
}
}
ok in this example i was wondering (in the main class) why do we have to define a variable in a different class and refer to it would it not be easier if we just define the propertynumber and all others in the "main" class excluding class house? umm i cant even explain what i m not understanding :P