Results 1 to 2 of 2
  1. #1
    Zarquad is offline Member
    Join Date
    Jul 2013
    Posts
    14
    Rep Power
    0

    Default What's wrong with this program?

    It's from a textbook.
    Java Code:
    class Time {
    int hour, minute;
    double second;
    public Time () {
    this.hour = 0;
    this.minute = 0;
    this.second = 0.0;
    }
    public Time (int hour, int minute, double second) {
    this.hour = hour;
    this.minute = minute;
    this.second = second;
    }
    public static void main (String[] args) {
    // one way to create and initialize a Time object
    Time t1 = new Time ();
    	t1.hour = 11;
    	t1.minute = 8;
    	t1.second = 3.14159;
    	System.out.println (t1);
    	// another way to do the same thing
    	Time t2 = new Time (11, 8, 3.14159);
    	System.out.println (t2);
    	}
    }
    It keeps outputting "Time@" followed by a bunch of numbers/letters. The numbers/letters change depending on what I comment out.

  2. #2
    Zarquad is offline Member
    Join Date
    Jul 2013
    Posts
    14
    Rep Power
    0

    Default Re: What's wrong with this program?

    Nvm, ignore this thread. I can't figure out how to delete it.

Similar Threads

  1. What is wrong with my program?
    By icykum in forum New To Java
    Replies: 3
    Last Post: 09-23-2012, 10:34 PM
  2. What's wrong with this program?
    By java_aim in forum New To Java
    Replies: 8
    Last Post: 11-02-2011, 01:01 PM
  3. what the wrong in my program ><
    By MSs.Java in forum New To Java
    Replies: 4
    Last Post: 05-03-2010, 01:28 PM
  4. What's wrong in my program...?
    By Annatar in forum Java Software
    Replies: 3
    Last Post: 10-31-2008, 06:03 AM
  5. what is wrong with this program ?
    By Poor Bee in forum New To Java
    Replies: 1
    Last Post: 05-07-2008, 07:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •