Results 1 to 5 of 5
  1. #1
    tking88 is offline Member
    Join Date
    Oct 2009
    Posts
    16
    Rep Power
    0

    Default Need Help With Java Code Checking & Problem Solve

    This Thread Closed !
    Last edited by tking88; 10-23-2009 at 02:54 AM.

  2. #2
    [RaIdEn] is offline Senior Member
    Join Date
    Oct 2009
    Location
    California,US
    Posts
    201
    Rep Power
    6

    Default

    hey if you dont mind can you specify your error or a part where you want help with ? that would be great

    mext time do add code tags :)

  3. #3
    [RaIdEn] is offline Senior Member
    Join Date
    Oct 2009
    Location
    California,US
    Posts
    201
    Rep Power
    6

    Default

    ok here
    Write a PersonAbstract class that has one abstract method: ToString

    this states to make the to string method abstract so you dont need to implement the method

    abstract String toString()
    ; is enough

    But in the other Person class where you extend the abstract class
    There you need to implement the toString method. this is called overRiding.

  4. #4
    [RaIdEn] is offline Senior Member
    Join Date
    Oct 2009
    Location
    California,US
    Posts
    201
    Rep Power
    6

    Default

    as for the Part B when you extend . you overrite the to String method of the person class.

    by declaring the method signature and body where you channge the "tenure" part of the

    method as stated in the problem description.

    its the same in part c but you need to check for the other "Field"

  5. #5
    [RaIdEn] is offline Senior Member
    Join Date
    Oct 2009
    Location
    California,US
    Posts
    201
    Rep Power
    6

    Default

    Quote Originally Posted by tking88 View Post
    So for the Abstract Class I do like this ?

    Java Code:
    abstract class PersonAbstract {
    	
    		public String toString() {
    
    	}
    }
    and in Teacher & Studend Class

    I do overriding like this ?

    Java Code:
    	public String toString() {
    		return super.toString();
    	}
    no

    here

    Java Code:
    [CODE]abstract class PersonAbstract {
    	
    		public String toString();
    }
    and in Teacher & Studend Class

    I do overriding like this ?

    Java Code:
    	public String toString() {
    		String message = "Name: " + name + "\n" + "Age: " + age + "\n"		+ "Tenure: " + tenure + "\n"		;
    		return message;
    	}
    [/CODE]

Similar Threads

  1. Help me to solve problem
    By mansoorhacker in forum Forum Guides
    Replies: 8
    Last Post: 01-24-2009, 06:29 PM
  2. Help me to solve problem
    By mansoorhacker in forum New To Java
    Replies: 3
    Last Post: 11-13-2008, 08:15 AM
  3. Can any one solve this?I want full code.
    By sreenathuuu in forum New To Java
    Replies: 3
    Last Post: 08-20-2008, 08:45 AM
  4. Replies: 8
    Last Post: 01-07-2008, 05:41 AM
  5. java code for checking if a software is installed or not
    By heggemony in forum Advanced Java
    Replies: 1
    Last Post: 07-31-2007, 01:19 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
  •