Ikpefua Jacob-Obinyan wrote:Now according to the JLS, I just found out that there are circumstances where static members can be inherited please checkout this LINK when you are there, go to section 8.1.3 it says quote
Inner classes may INHERIT STATIC MEMBERS that are not compile-time constants even though they may not declare them
If the Java Language Specification says this, there is every logic in what I said, which I will repeat here. Quotestatic members are in a 'sense' inherited, but NOT that same 'strong sense' that instance variables and methods are.
When you use the keyword 'extends' it means 'inheritance' and if as a result you have access to static members of the superclass it is 'more or less' in the context of inheritance.
This is my point of view.
Regards
Ikpefua.
Ikpefua Jacob-Obinyan wrote:Jack...Thanks for your argument, now what I can confirm at the moment is that static members are in a 'sense' inherited, but NOT that same 'strong sense' that instance variables and methods are.
An evidence is that you CANNOT 'override' a static method, however it CAN be 'redifined'.
Now as a result of what you said, I am convinced that if we are asked in the exams the answer should be that static members are NOT inherited or else otherwise proven.
The compiler indication dissappears from my program if you do this:
Ikpefua Jacob-Obinyan wrote:@Jack can you please post your complete code here, lets see why it provoked a compiler error?
Another thing I want to CLARIFY is that polymorphism (in terms of inherited members 'usage') ONLY works with instance 'non-static' methods, NOTHING more. I am sure that is where the confusion is, because it will look like inherited static members were NOT inherited in the first place.
The static field Jack.i should be accessed in a static way
The static method go() from the type Jack should be accessed in a static way
jishnu dasgupta wrote:hi All,
Just dont want to confuse every one, but isnt a an object reference pointing to an Array of int. so When a =b, doesnt it means that a now points to the array {2,3,1,0}, so when the 3 rd position value is retrieved, which is 0, shouldnt the return value be 2???
Matloob Hussain wrote:
Ikpefua Jacob-Obinyan wrote:
javac -d ..\..\classes .\.\.\wickedlysmart\MyClass.java
Hi Ikpefua,
You used .\.\.\wickedlysmart\MyClass.jave to get java file. Could you please explain the use of .\ three times.
Ikpefua Jacob-Obinyan wrote:
Jack Tol wrote:To go two directories up you'd use: javac -d ../../classes com/wickedlysmart/MyCass.java.
Hello Jack, what you have said is to go ONE directory up and NOT two directories up because the first "." dot refers to the current directory, to go two directories up, you need one more dot.