Results 1 to 6 of 6
Like Tree1Likes
  • 1 Post By Tolls

Thread: variable type

  1. #1
    happy0611 is offline Member
    Join Date
    Jul 2012
    Posts
    3
    Rep Power
    0

    Default variable type

    I know that variable type can be int, String, long , double , Boolean etc. But what type of variable is it?
    Java Code:
    private Address studentAddress;
    . Please tell me the details about it.
    Last edited by happy0611; 07-05-2012 at 12:18 PM.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,097
    Rep Power
    20

    Default Re: variable type

    Well, you could tell us what error you get.

    Variables can be primitives (int, float, boolean, etc) or an object reference.
    noobplus likes this.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    happy0611 is offline Member
    Join Date
    Jul 2012
    Posts
    3
    Rep Power
    0

    Default Re: variable type

    i have remove the error . here is the code. please tell me the details about the address type variable.

    Java Code:
    public class Student implements java.io.Serializable {
    
    	private long studentId;
    	private String studentName;
    	private Address studentAddress;
    
    	public Student() {
    	}
    
    	public Student(String studentName, Address studentAddress) {
    		this.studentName = studentName;
    		this.studentAddress = studentAddress;
    	}
    }

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,097
    Rep Power
    20

    Default Re: variable type

    What details are there to tell?
    It's your class.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    happy0611 is offline Member
    Join Date
    Jul 2012
    Posts
    3
    Rep Power
    0

    Default Re: variable type

    I only need to know about
    private Address studentAddress

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,097
    Rep Power
    20

    Default Re: variable type

    Yes, and Address is your class (presumably).
    'studentAddress' is a reference to an Address object.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Replies: 1
    Last Post: 01-02-2012, 11:16 PM
  2. Using class type as variable
    By tschaitanya in forum New To Java
    Replies: 3
    Last Post: 12-02-2011, 06:52 PM
  3. What variable type should I use?
    By Eleeist in forum New To Java
    Replies: 18
    Last Post: 08-01-2011, 02:55 AM
  4. Print variable data type
    By BillyB in forum New To Java
    Replies: 1
    Last Post: 01-14-2011, 04:37 PM
  5. do while (variable != type)
    By Romally in forum New To Java
    Replies: 2
    Last Post: 11-15-2010, 05:29 AM

Posting Permissions

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