Latest Tutorials| Questions and Answers|Ask Questions?|Site Map




Have Programming Question? Ask it here!
 
 
 


sassy
OOP questions
1 Answer(s)      5 years and 9 months ago
Posted in : Java Beginners



Advertisement
View Answers

November 26, 2008 at 11:27 PM


Hi friend,

a. How many members does class XClass have?
Answer : 6

b. How many private members does class XClass have?
Answer : 2

c. How many constructors does class XClass have?
Answer : 2

d. Write the definition of the member func so that u is set to 10 and w is set to 15.3
Answer :
public void func()
{
u = 10 ;
w = 15.3;

}

e. Write the definition of the member print that prints the contents of u and w.

Answer :

public void print()
{
u = 10 ;
w = 15.3;

System.out.println("u : " + u);

System.out.println("w: " + w);


}
f. Write the definition of the default constructor of the class XClass so that the instance variables are initialized to 0(zero).

Anwer :

public XClass()
{
u = 0 ;
w = 0;
}

For more information on Java visit to :

http://www.roseindia.net/java/

Thanks


Related Tutorials/Questions & Answers:
 

 

 

DMCA.com