Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP 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: 4587
302
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