About Question enthuware.ocajp.i.v7.2.957 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
dmcinnis1
Posts: 16
Joined: Wed Feb 25, 2015 8:52 pm
Contact:

About Question enthuware.ocajp.i.v7.2.957 :

Post by dmcinnis1 »

Why are someInt and changeIt accessed directly by main instead of TestClass.someInt and TestClass.changeIt. Is it because main is in the TestClass class? Because it is a static method ans static methods can directly access static variables and static methods?

admin
Site Admin
Posts: 10389
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v7.2.957 :

Post by admin »

Yes, static as well as instance methods of the same class can access other static methods and static variables without the need for writing the classname. Instance methods can access instance fields as well without any qualifier.

Mushfiq Mammadov
Posts: 32
Joined: Fri Oct 16, 2015 4:33 am
Contact:

Re: About Question enthuware.ocajp.i.v7.2.957 :

Post by Mushfiq Mammadov »

"an" is written twice
Image

admin
Site Admin
Posts: 10389
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v7.2.957 :

Post by admin »

Fixed.
thank you for your feedback!

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests