Java Queries Here..

TheSloth

The Slowest One
Joined
May 24, 2012
Messages
1,845
^this. And to understand why or how do we use Class/Interface names to call static method, you should read how the memory allocation works in Java.
 

quicky008

Well-Known Member
Joined
Nov 27, 2007
Messages
2,124
i'm sorry if this seems irrelevant,but can someone recommend some good books for the foll. subjects:

1.Algorithms-it should cover all the essential precepts,including things like time complexity,space complexity etc in an easy to understand manner.

2.Automata.-i hardly know much about automata and would like to improve my understanding and knowledge of this subject to a greater extent.Ullman's book on automata is really popular-but is it easy to grasp for people who are not very familiar with this subject?

3.Data structures-the market seems flooded with a myriad books on this subject.But which one would be truly helpful for beginners?

4.Assembly language programming-while i have no immediate need for learning this subject,i still would like to explore it sometime later,simply because of my interest in this field.

5.Core java and advanced java programming.

Ps. recently i came across a book called "cracking the coding interview" on amazon.It seems very highly rated and is probably intended to help people acquire a more in-depth knowledge of the process of solving difficult problems that one may be given during tech-interviews/exams etc-is this book really as good as its made out to be?
 
Last edited:

TheSloth

The Slowest One
Joined
May 24, 2012
Messages
1,845
The last book I used to learn anything related to career was probably 6-7yrs back, from the book Desmond suggested. It really is a good book for beginners. You could also try Head First Java. I usually go for online resources. You could try Udemy, MOOC EDX Online courses for all these topics. They provide demo and you get the option of refund if you didn't like the teaching of the instructor on Udemy.
 

thetechfreak

Legend Never Ends
Joined
Nov 1, 2008
Messages
9,901
Don't know about others but Herbert Schildt's book is best for Java. I think it's called Java complete reference or something.
+1 for this. My college professor(during bachelor degree) consulted this book and Head First. Both of them are very good. Great for learning Java. It's a shame I haven't written much Java after my Bachelor's degree(other than for Android).
 

thetechfreak

Legend Never Ends
Joined
Nov 1, 2008
Messages
9,901

5 Java based books fro $1.
Yeah worth it. Also, a whole book dedicated to threads. Wow. @dDesmond David could use it maybe.

The 8$ bundle with Kotlin is something I could consider.

Sent from my vivo 1807 using Tapatalk
 

Desmond David

Destroy Erase Improve
Staff member
Admin
Joined
Apr 9, 2005
Messages
7,674
Wow, those are some pretty good books.

Edit: Bought all of them. Now will I get time to read, that is the question.
 
Last edited:

TheSloth

The Slowest One
Joined
May 24, 2012
Messages
1,845
I also have been thinking to buy because of Java Threads but I am not able to decide. Do we really need to think about threads in web development when all the java based frameworks like Spring Boot, Play etc runs in a container which is self managed by the containers. Am I right?
What use cases do we have in today's Java programming where deep knowledge on Threads might come handy?
 

Desmond David

Destroy Erase Improve
Staff member
Admin
Joined
Apr 9, 2005
Messages
7,674
Do we really need to think about threads in web development
Not really but depends on your use case. It's most helpful if you are doing something like batch processing.
Spring Boot, Play etc runs in a container which is self managed by the containers. Am I right?
These don't run in a container by default. You will have to write a Dockerfile for your build to run in a container.
What use cases do we have in today's Java programming where deep knowledge on Threads might come handy?
Like I said, batch processing or data processing. Like if you have to process a large number of files, then you will have to use threads to process them parallelly to increase throughput. But then again you don't have to know too much for most common use cases, just general idea is usually enough.
 

TheSloth

The Slowest One
Joined
May 24, 2012
Messages
1,845
These don't run in a container by default. You will have to write a Dockerfile for your build to run in a container.
Doesn't spring/play comes with its own container which creates a independent thread for each (http)request and those threads are managed until the purpose is served.
 

Desmond David

Destroy Erase Improve
Staff member
Admin
Joined
Apr 9, 2005
Messages
7,674
Doesn't spring/play comes with its own container which creates a independent thread for each (http)request
If you are speaking about servlet container, then yes. But this is not something spectacular, a servlet container is basically same as an ordinary web server with the added functionality of running web applications and routing the requests to the appropriate web applications. As such, like any other web server, it creates new threads to handle requests.
those threads are managed until the purpose is served.
But not by us, the request thread's lifecycle is handled internally by the servlet container. We can spawn new threads for our own purposes though INSIDE the servlets but not in the servlet container itself.

For example, say I want to create a web application that takes a date range and calculates the average salary of all employees within that time range. In that case, you can define a servlet to spawn multiple threads to perform this calculation in parallel. But this is after the servlet container receives the request and spawns a thread to handle the request and then route the request to your container. So, you don't have to worry about how the servlet container is handling the threads.
 

TheSloth

The Slowest One
Joined
May 24, 2012
Messages
1,845
Very well explained. So far I have not implemented anything significant/exciting using Threads and since everything gets taken care by servlet container itself, I feel even more lazy to go through this topic since I have other things to focus on.

Also i gave in and bought the books for my collection. Paid Rs.77.71 instead of 74.
 
Top