• Post Reply Bookmark Topic Watch Topic
  • New Topic

hello everyone, i have two different questions please  RSS feed

 
Dan D'amico
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. I bought a tablet - Asus TF103c ,based on android .
what is the best jave compiler I can get that will do the job on the tablet ?
right now on my PC I'm using notepad and compile via CMD.

2. I red a lot of articles and also a topic from a book called Java Solutions, about inheritance :
- in the book its says that a subclass doesn't inherite the private fields, and methods. is this true ?
because if a subclass B extends A , so , B is-a A.
can i can a good clarification on this ?


 
Tim Cooke
Marshal
Posts: 4041
239
Clojure IntelliJ IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Programming on a tablet sounds like a horrible idea.

2. Yes it's true. A type is defined only by it's public interface.
 
Andy Totes
Greenhorn
Posts: 3
Java Mac Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey!
Q1:
In order to develop rapidly, I suggest using an IDE such as Android studio, or Eclipse with an android plugin, these IDE's have an emulator so that you don't have to deploy the program to the device in order to test it.
http://developer.android.com/sdk/index.html

Q2:
This is correct, you cant access a private field directly in an inherited class, but assuming you have set up a getter and setter for the field in the original class, you will be able to "set" the field using that method or get the value of the field by using the "getter". This process is often included in chapters related to Encapsulation.
http://www.tutorialspoint.com/java/java_encapsulation.htm

Have fun!
 
Paul Clapham
Sheriff
Posts: 22828
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Agree 100% with Tim's number 1. Even answering forum posts on a tablet is annoying -- I'm doing that right now. I can't even imagine programming on one.
 
Dan D'amico
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this tablet has a transformed associated keyboard with it.

yes i can get the field's value using a getter.

so B extends A.
● B doesnt inherite A's private field. but it can call super() for that field in the constructor?

● since B and A have the same field name. B's field hides A's field?
what are the consequences of this ?
 
Tony Docherty
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dan D'amico wrote:
so B extends A.
● B doesnt inherite A's private field. but it can call super() for that field in the constructor?

Not sure what you mean by this. A constructor of a sub class has to ultimately invoke a constructor of the super class and if you don't explicitly call super(..) with an appropriate set of parameters a super() (with no parameters) is inserted for you, of course this only compiles if the super class has a visible no args constructor.

Dan D'amico wrote:
● since B and A have the same field name. B's field hides A's field?
what are the consequences of this ?

It makes no difference to the compiler, but it can be very confusing to us humans.
My advice is don't do it, I can't think of a single valid reason for hiding a variable in this way - it can only cause problems at a later stage.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66306
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the future please do not post more than one question per topic.
 
Dan D'amico
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
understood.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!