Display Regular Time program

0 Akshay Pimpalkar · October 2, 2015
I tried thousand times but i couldn't fix errors in this program. Somebody plz help me.....

public class apples {

public static void main(String[] args) {
tuna tunaObject = new tuna();
System.out.println(tunaObject.toMilitary());
System.out.println(tunaObject.toString());

tunaObject.setTime(13, 27, 6);
System.out.println(tunaObject.toMilitary());
System.out.println(tunaObject.toString());

}

}



public class tuna {
private int hour;
private int minute;
private int second;

public void setTime(int h, int m, int s){
hour = ((h>=0 && h=0 && m=0 && s

Post a Reply

Replies

Oldest  Newest  Rating
0 Akshay Pimpalkar · October 14, 2015
Oh I just made mistake...... Hey Thanks Lotfi Ace for correcting me.:)
0 Lotfi Ace · October 3, 2015
You didnt close the brackets in the tuna class, the setTime function and the hour variable. Check that first. 
You may want to rewrite he body of your setTime function
Then go back to the tutorial and check you copied the code correctly
also why didnt you assign the integer parameters in the setTime function to the private variables you declared earlier?


e.g

hour=h;
minute=m;
second=s;
0 ariel bitan · October 4, 2015
What he said
  • 1

Java / Android Development

107,205 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator