Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
    Bookmark Topic Watch Topic
  • New Topic

object creation in java

 
Aashish Jd
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Report post to moderator
i am beginner in java and had little confusion with these object creation.I was making this code for assigning object to other object
here is the code

i like to know how the gb and gb1 object can be declared inside its own class ???

class Obj {
float b;
public static void main(String[] args){

Obj gb=new Obj();
Obj gb1=new Obj();
gb.b=3;
gb1.b=4;

System.out.println("first--->"+gb.b+"\n Second"+gb1.b);

}

}

i like to know how the gb and gb1 object can be declared inside its own class ???
 
Devaka Cooray
ExamLab Creator
Marshal
Pie
Posts: 4392
249
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please don't create duplicate topics. I'm closing this one. Let's continue the discussion in your other topic
 
    Bookmark Topic Watch Topic
  • New Topic