Amruta nikam

Greenhorn
+ Follow
since Sep 28, 2013
Amruta likes ...
Eclipse IDE Chrome Java
Merit badge: grant badges
For More
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
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Amruta nikam

thank you guys after calling settimezone method it worked. I am working in EST time zone and server time is UTC
9 years ago

Hi I am working on set top box (STB) application where we need to convert UTC time to local time and display it on App.
From some third party API's we are getting time in UTC as String and we need to convert it to local time zone and display it on App.
below is the code :


after checking server logs till dateFormateInLocalTimeZone its working fine but String formattedTime = displayTime.format(d); after this line of code
the formattedTime var contains the time in UTC and not in local
9 years ago

Nakul P. Patel wrote:Hi All,

I want to pass the SCWCD exam.
I wanted to know few things,
1) Is there any difference between the version 1.5 and 6? I meant to say it seems like both the exams covers same topic.
2) I would like to go for lattest version EE 6(IZO 899).Please suggest me a reference book for it.

I am having dilemma about the Head First for servlet and jsp. I love the head first series, but is it enough to read only this book to pass EE 6 ?

Please let me know.
Thanks in advance





Hi you can also refer
SCWCD
EXAM STUDY KIT
by -Hanumant Deshmukh
Jignesh Malavia
Matthew Scarpino

Dan Good wrote:Inputs, Outputs, decrements, increments, class string, at Fairfield University. We use the book Java Programming: From Problem Analysis to Program Design. The book is difficult to follow if you know nothing about coding...



well for beginners Head first java is the best book so far
10 years ago

Justice Smith wrote:Here I am again. Trying to create this first class (Bank Account), then use it in class (Tester). It tells me it can't recognize variable "balance" when I try to compile class Tester.





I don't know what I'm doing wrong, but it says it can't recognize the variable "balance" in the second set of code.



Hi use myAccount.balance instead of balance inside system.out.println

however its not the way to access variables.... read about getters and setters...so whenever outside the class you are trying to access or chnage the value of any variable you should access it through getters and chnage it by using setters
google it you can find so many tutorials on it...

and you are getting that error because you are trying to access non static variable inside static method(here main())
10 years ago

Steve Luke wrote:The Executor, Callable, and Future are used for three different purposes.

The Callable is the closest thing to Runnable, the biggest difference is that Callable's call() method has a return value while Runnable's run() method returns void. So think of Callable as a task which produces a result, and a Runnable as a task which does not.

The Executor is a container used to run tasks. There are different varieties, and you can build your own, but the idea is you give an Executor a Runnable and it decides when, where, and how to call the run() method. The most common scenario for an Executor is a Thread Pool, which contains and holds a bunch of running Threads and distributes tasks to the Threads to run.

There is a sub-interface of Executor called an ExecutorService, which acts like an Executor but also allows you to submit Callables as well as Runnables. When you submit a task to an ExecutorService you get a Future, which is used to track the progress of the task that was run. It will let you cancel the task, check to see if its is done, or get the results (if the task was a Callable), waiting for it to complete if not done yet.



Thanks in tons.....I understood it finally
can anybody tell me in simple language that What the job or use of Executor, callable and future as compared to Runnable interface
I am reading it since last week but not able to understand it properly

Souvik Dasgupta wrote:
Download MySQL JDBC driver from the below link:

MySQL JDBC Driver. It is a jar inside a zip folder. Refer the jar file to your application(You can put that jar inside ext/lib also). No need for OJDBC jar. Thats for Oracle DB.


thank you so much its working now
MSql is working properly but what i am supposed to do after that....It might sound stupid...but I am new to jdbc ...i have installed ojdbc.jar and place it in ext folder under bin dir...but is that ok if i am using MySQL and downloading driver from oracle...means is there any driver which only i supposed to install for MySql
i have gone through so many you tube videos but still confused....
i have installed Mysql and what i supposed to do after that...i guess i have to install jdbc driver...
so from where should i install it from Oracle site or MySQL....
anybody please list down the steps so that i can follow and run my first jdbc program...and can you please provide links too..

Campbell Ritchie wrote:

Khushabu Wankhade wrote:i have inserted print statements in hashCode and equals method but its not reachable . . .

I did not intend you to put print statements inside hashCode nor inside equals. If you had run the code I posted, you would have seen that the hash codes were different. And you would have seen, as Steve has explained, that you would look for those pairs in the wrong bucket in your Map.
You are mistaken saying that the hashCode and equals methods are not reachable. Both are behaving as expected in this instance, and both are reachable. Their overriding behaviour adn polymorphism are correct.
The link I gave you earlier says that the behaviour of a Map is not specified. You cannot predict that you will find the “V” if you have mutable“K”s. You are changing the values used in the equals method, so you cannot expect the Map to behave predictably.


oh no no....you didn't...but I kept it intentionally to look that whether my equals and hashCode is reachable or not
10 years ago

Steve Luke wrote:Your problem is that you are re-using the same instance of dog. In the code in the original post, line 8 you create the dog instance. Then in line 15, you change the name stored in the dog instance to mangolian and in line 16 you try to get it. When you get it from the HashMap, the hashCode for dog is 9 (the length of the string "mangolian"), and there are no dogs in that bin in the HashMap so you get null as a result.

Then in line 17 you change the name stored in the dog instance to "nancy". Note that nancy has the same length as Rover, and so in line 18 when the HashMap goes to look up the dog, it finds an instance in the correct bin. This is the same instance dog that you created in line 8 and whose name you changed in line 17, so when HashMap calls its equals method it compares the value of the names - which will return true because you are using the same instance (the instance you put into the Map as a key to "Rover value" no longer has a name of Rover, it has a name of nancy.) That is why you get the value back in the second case.

Now in the third case, on line 19 you create a new dog instance and give it a name "Rover". This new instance will look into the correct bin, because it has the correct name length, but since the original instance doesn't have the name "Rover" any more (it has "nancy") the equals comparison will be false and you won't get a value returned.

Rule number one for an Object that will be used as a key in a map is to have good hashCode() and equals() implementations. Rule number two is to make it immutable - meaning the values it stores can't be changed. The fields must be private, assigned in the constructor, and only accessible via get() methods (not set() methods). Look up immutable objects for more info on how to do it right.



hey thanks...now i got it.....what I was thinking is even though I change the Dog name but the key is not going to change because i put it in the map before changing the Dog name...
that's where i went wrong ....So what i understood from your explanation is that...whenever i change the key value...its going to reflect in actual key inside the Map...means if I am putting "Clover" as a key and then changing the name to "Jimmy" then Map also have the key as "Jimmy" and not the "Clover" is that correct??
10 years ago

Khushabu Wankhade wrote:i have inserted print statements in hashCode and equals method but its not reachable



my hahscode is reachable but not the equals method
10 years ago
i have inserted print statements in hashCode and equals method but its not reachable
10 years ago

Campbell Ritchie wrote:





now I inserted Print statements in my equals and hashcode methods but its calling objects hashcode and equals method and not the overridden method...I m confused about the whole thing...whats happening over here
10 years ago