• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reference variables, how does this code work  RSS feed

 
candy man
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi can anyone please help in understanding the below code:-

please tell me what is the meaning of a1.b1, a1.b2, a2.b2?? what they are refering to? Please explain
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16058
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a1 refers to an object of class Alpha.
a2 refers to another object of class Alpha.

Class Alpha has two member variables, b1 and b2.

a1.b1 refers to the member variable b1 in the Alpha object that a1 refers to.
a1.b2 refers to the member variable b2 in the Alpha object that a1 refers to.
a2.b2 refers to the member variable b2 in the Alpha object that a2 refers to.

These are fundamental concepts about classes. See Classes in Oracle's Java Tutorials to learn how classes work.
 
Ivan Jozsef Balazs
Rancher
Posts: 999
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


"class" or "Class" ?
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
 
Campbell Ritchie
Marshal
Posts: 56533
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry Wong wrote:Please QuoteYourSources.

Henry
Agree. Please read this link. That is required for continued discussion.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!