public class Clock
{
private int newHour;
private int newMinutes;
private int newSeconds;

public Clock ()
{
}
public Clock (int newHour, int newMinutes, int newSeconds)
{
this.newHour = newHour;
this.newMinutes = newMinutes;
this.newSeconds = newSeconds;
}

public int getNewHour(int newHour){
return this.newHour;
}
public int getNewMinutes (int newMinutes){
return this.newMinutes;
}
public int getNewSeconds (int newSeconds){
return this.newSeconds;
}

public void setHour(int newHour){
    this.setHour = setHour;
}
public void setMinutes (int newMinutes){
    this.newMinutes = newMinutes;
}
public void setSeconds (int newSeconds){
    this.newSeconds = newSeconds;
}

public void display (){
System.out.println (int newHour + int newMinutes + int newSeconds);

public String showTime (){
System.out.println ("hh:"+ "mm:"+"ss");
}

public static void main(String[] args)
{
    Clock objClock = new Clock();
    objClock.showTime();
    objClock.display();
}

}

Recommended Answers

All 2 Replies

You didn't say anything about the error. Is it line 38 - invalid syntax?

commented: Can't get the comment to work sorry +0
  public void setHour(int newHour) {
    //this.setHour = setHour;
    this.newHour = newHour;
  }

  public void display() {
    //System.out.println(int newHour + int newMinutes + int newSeconds);
    System.out.println( newHour +":"+ newMinutes +":"+ newSeconds);
  } // added

  public String showTime() {
    System.out.println("hh:" + "mm:" + "ss");
    return ""; // added
  }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.