Bhakundo Karki

Greenhorn
+ Follow
since Sep 03, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Bhakundo Karki

thanks everyone! i think i will start with the link given for OO and thanks for all the responses.
14 years ago
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
14 years ago