Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!

sahil Kairon

Ranch Hand
+ Follow
since Aug 17, 2021
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by sahil Kairon

Well that's true,  java is strictly case sensitive language and it takes quite practice and time for becoming used to it.  Thanks Campbell for all your help, it was really nice discussing on this topic with you. Keep up the good work.
Well i will not be using capital C in class while writing it in code, I just wrote it for highlighting it. What you are saying is also true, will take care of it in future. Thanks for explaining things.

Campbell Ritchie wrote:

 But the m1() method is unaware of the existence of the subtype, so it cannot bind to 5. Please always use CapitalLetters for ClassNames.

Moving discussion to our OCA forum.

And I guess I got my answer. Thank you so much. I think this is the reason why output is 4 in above program.
Really sorry for confusing you. I mean to say Class job Object and Class test Object and I am confused that why it is giving 4 as an output and not 5.
We have redeclared int i variable in Class job and we are calling m1() method with class job Object.
Hello Everyone,
I am very confused with this program. I am a beginner so please help me with this.

I want to understand that we are calling the m1() method using job class object and we have also declared int i again in job class, then why it is still printing the int i variable of test class. I am confused with this, please help me.
Thank you.
Thank you Campbell Ritchie for explaining with such a patience and clearly. I got it now. Once again thank you so much.
Thats true, even if we call GC it is not compulsory that GC will run. I was asking in a hypothetical way, that suppose GC runs, then object referred by a2 will become eligible for GC at the same line (// line 1) or when the compiler reaches next line.

a At least two objects are garbage collected on line 1.
b At least one object is garbage collected on line 1.
c No objects are garbage collected on line 1.
d The number of objects that are garbage collected on line 1 is unknown.
e At least two objects are eligible for garbage collection on line 2.

This was the actual question and answer was Option: - d,e

So after visiting this question, this thing strikes my mind that what if the examiner asked specifically that object referred by a2 will become eligible for GC at Line number 1 or not ?

And I am beginner with java, so please ignore if I made any wrong statement,
Thank you Campbell Ritchie for the reply. Actually I am giving Java 8 OCA exam this week and while practicing the mock test exam given in Mala Gupta OCA 8 book, I came across this question. That is why I wanted to know that if the object referred by a2 will become eligible for GC at Line 1 or when code reaches Line 2. I know in real world programming it might not be of that significance, however from Certification point of view, I have to prepare for every single aspect.
Hello Everyone,
I am new to java and I am getting confused in one statement on Garbage collector. Please help me with this.

So, I wanted to know that, when we did a2 = null on Line 1, so I just wanted to confirm that a2 object becomes eligible for Garbage collection on the same line or when the code flow goes to Line 2. Please help me with this, it is creating a confusion in my mind.
Thank you.
Thank you Carey Brown for helping. Yes that was the issue, I was using ISO_LOCAL_DATE_TIME as a format and only passing Date object in parse, so that is why it was giving me exception. Thank you so much.
1 month ago
Hello Everyone,
I am new to java and I am trying to understand the use of date and time in java. And while studying DateTime Formatter I wrote a code and this code is giving me a run time Exception "UnsupportedTemporalTypeException". I don't know why. I am getting very confused in it. Can you please help me with this.

Please help me with this.
1 month ago
Thank you so much Jesse Silverman for helping me out. Really appreciate the efforts. I know many beginners like me will confuse in such topics and will make sure to help them with such patience and clarity as you did today.
Well I am quite new to this. And I am learning java.  Please ignore if i sound stupid. What I have learnt so far was that static method are not inherited by the subclass and they cannot be over-riden. So I was confused that "are static variables inherited by the subclass" ?