Win a copy of Microservices Testing (Live Project) this week in the Spring forum!

Sunny X Narula

Greenhorn
+ Follow
since Dec 07, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sunny X Narula

Thanks for that Akanksha
Its clear now.
One doubt

Remember Postincrement operator increments the value only after the execution of the current statement (in this case - y = x++ + ++x; )



Before the statement, x is -1 and y is 0.
So as per the explanation above the code must translate to:


y should not get the value from x++ (thats what I thought) but it does.
In fact it behaves as if the code was


That is the only way y can end up with 1 else it should be -1.

May be I am missing some concept here/I might be confused but that is how it works.
I am guessing this has something to do with priority while evaluating an expression. I think ++ has higher priority than +.
Any references will be helpful.
Thanks in advance for any help.
Thanks for the explanation Ninad
I would still appreciate if someone could point me to the book's errata.

Regards
Hi
I have been trying to find errata for SCJP 6 book but unable to find it so posting the question here.
Octal literals can have up to 21 digits not including the leading 0.
My question is whether this accounts for the sign bit which makes it possible to create a literal like:



which makes it 22 digits excluding the leading 0.

I was hoping I could find an errata link so I did not need to post this question.
I hope some one can point me to it.

Regards
Hope this looks elegant but again it all depends on what you need
12 years ago
May I suggest separating the gui operations you are trying to automate on to a separate class.
I think what you have is a simple GUI so a View class makes sense and along with it you will need a Model class which is actually the data values and all which in your case I guess is the Configuration class.
Now I imagine you want the configuration to do some operations in a separate thread, which would be the only case where the GUI / View class would not exist.
If you really want that you would want to create a separate controller class which would take you out of the dilemma. This controller would be responsible for creating instance of Model and View and providing whichever where - ever you need.

If you really don't want/have a separate thread, you do not need to worry so much, its like you do not create one without the other and then you can use appropriate setters and getters to do the job. That part I guess has already been answered in the post.

Hope this gives you some direction. This is a design problem not a general java problem.

Regards
12 years ago
Your code says 0/x not x/0 so its not an arithmetic exception

The answer should be:
null<Space><Newline>
null<Space><Newline>

not "null null" since this is a println

And yes the diamond is just to distract the miner
If by different you mean correct date but in a different format (other than MM/dd/yyyy),
try skipping locale.
There is no need for the locale, by default I guess, the language must be English or as set on the server.
12 years ago
Your reference for d is not correct.
Actually after
A d=new A().aob=new A();

the d.aob is null.
The statement can be understood as being equivalent to:


Now in our actual program the object temp is implicit, it has no reference so it becomes eligible for GC after the line 10 executes.
Thanks Ankit
That settles it for me.
Let me try this again, when explicitly casting will any code that uses non primitive types ever fail at compile time.
Sorry if the my question was unclear.
Could anyone post an example of inconvertible types which is not a primitive type.
Or is it so that there are none.
Which would explain why this compiles but does not run:
Can anyone humor me and post the code it would take to actually print the last "Printed".
Thanks in advance.
Hand shake exception is caused due to java not being to handle SSL connections by default.
As per my understanding when you open a secure internet connection over https you need to exchange certificates which the server uses to identify the caller and so that the security of the transferred information can be ensured.
Also this is a session specific thing.
I have had the problem when working with websphere and these are the settings I do to solve it.



You need to know who you are talking to and use an appropriate handler. May be there is some sort of generic handler that can be used for all https connections.
12 years ago