java constructor..!

Reply

Join Date: Oct 2006
Posts: 15
Reputation: THK is an unknown quantity at this point 
Solved Threads: 0
THK's Avatar
THK THK is offline Offline
Newbie Poster

java constructor..!

 
0
  #1
Oct 7th, 2006
You are given a class named Clock that has one int instance variable called hours . Write a constructor for the class Clock that takes one parameter, an int , and gives its value to hours .

help me some one
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 609
Reputation: freesoft_2000 is an unknown quantity at this point 
Solved Threads: 7
freesoft_2000 freesoft_2000 is offline Offline
Practically a Master Poster

Re: java constructor..!

 
0
  #2
Oct 7th, 2006
Hi everyone,

  1. public class clock
  2. {
  3.  
  4. public clock(int num)
  5. {
  6.  
  7. }
  8.  
  9. }

Richard West
Microsoft uses "One World, One Web, One Program" as a slogan.
Doesn’t that sound like "Ein Volk, Ein Reich, Ein Führer" to you, too?
— Eric S. Raymond

Tell me what type of software do you like and what would you pay for it

http://www.daniweb.com/techtalkforums/thread19660.html
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 30
Reputation: Rayhan Muktader is an unknown quantity at this point 
Solved Threads: 3
Rayhan Muktader Rayhan Muktader is offline Offline
Light Poster

Re: java constructor..!

 
0
  #3
Oct 7th, 2006
You need to give out more details. Do you wish learn how to write constructors in general or are having a particular problem with you Clock class?

Constructor for you Clock class would look something like the following code:

public Clock(int h)
{
this.hours = h;
}
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 15
Reputation: THK is an unknown quantity at this point 
Solved Threads: 0
THK's Avatar
THK THK is offline Offline
Newbie Poster

Re: java constructor..!

 
0
  #4
Oct 7th, 2006
thanks! it's been lot of help..
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC