What to read to understand how Java works? [closed] - java

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
Knowing how Java works in initializing objects and how it bind methods and fields to an object , abstract , final methods to an object and some other issues take a lot of time to guess myself , and i needed to ensure that every guess i made was correct by asking here and there .
I need some recommendations to read or watch (books-tutorials-articles-videos) , thanks in advance

What better source than Sun's Java Language Specification?

You can read any java book out there, there is a ton. But you won't know how java works until you actually start programming. Find a project and start coding!
I do like the Head First series for beginners. There is a Java book they publish. http://headfirstlabs.com/

Go through the article in http://www.javaworld.com/ and such sites.

if you want to understand how java works i would recommend Inside Java Virtual Machine by Bill Veeners

If you want low-level knowledge, perhaps studying the JVM itself would be appropriate.

Effective Java by Joshua Block http://astore.amazon.com/techncafe-20/detail/0321356683
Java Concurrency in Practice by Brian Goetz http://astore.amazon.com/techncafe-20/detail/0321349601

I'm currently waiting for Beginning Java Objects: From Concepts to Code to arrive on my doorstep. I hope it will be what you are looking for. I am purchasing this book because I too need help understanding objects in the Java language. I think it would be best to understand how objects are used in the language, then continue studying the language itself.
After that book, I'll go onto (or read at the same time) Beginning Java 2 by Ivor Horton. Both books received really good reviews on Amazon, so hopefully they are good for both you and I.

What I think you are getting at is how java really works under the hood. To that end, I think you would do well to understand byte-code, what java is interpreted to, and what the byte-code instructions mean to the jvm. By understanding what all of the Java language features convert to on a more raw level, you'll walk away with a much deeper understanding that, honestly, few people I've met have on the subject.
To this end, I'm going to suggest something that is a bit of a deviation from the norm and tell you to look at this book, Expert .NET 2.0 IL Assembler . That book is on the .NET intermediate language, the analogue to java's byte-code. I'm suggesting that simply because no good book exists on this for Java byte-code, and this is book gave me the understanding to easily tackle Java.

I would recommend SCJP preparation book:
''SCJP Sun Certified Programmer for Java 6 Study Guide''.
It has good overview over all java components. It speaks about neat areas, that you might get surprised with.

You need to go back to basics and read a good Java introduction (just skip the parts you know), as these are realy basic Java questions you have. Most popular text is:
Head First Java (2nd edition)
Or for a more down to earth advanced text:
Core Java, Volume I - Fundementals (8th edition)

Related

Working with LLVM from Java [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 2 years ago.
Improve this question
I'm fully aware that a similar question was already asked here: Generating LLVM Code from Java
The thing is, that was in 2012...I looked at the solutions and found most of the projects mentioned abandoned or at least very inactive.
So, as someone who is most used to working with Java, what would be my options for working with LLVM (to create a toy language, not using clang or anything)?
Try to use one of those projects, even if the might be outdated? Sounds like a bad idea.
Learn C/C++? Don't get me wrong, I already have a C++-book lying around and I don't say it's a bad language, but I highly doubt I would feel comfortable working with it.
Use bindings for other languages, like Haskell, Python, etc.? I might prefer that over C/C++, but that would mean to learn another complete language before getting started...
Write my own bindings? I never did anything like that,I would not even know the difference between JNI, JNA and whatnot...but might be interesting to learn.
Try to format LLVM IR in text form? Might work, but is probably not the best idea either.
Just to finally answer this, Java C++ Presets are a useful and mostly-upto-date option for this: https://github.com/bytedeco/javacpp-presets/tree/master/llvm
I came across the same problem recently since I'm using ANTLR in Java/Scala to define my lexer and parser and LLVM to generate the actual machine code through its IR.
In trying to bind JVM-based front-end to LLVM IR and back-end I am actually trying to use GraalVM https://www.graalvm.org/ since it offers a seamless way to interact across languages, including the LLVM bitcode, using its Polyglot.
Here some references:
https://www.graalvm.org/docs/reference-manual/languages/llvm/
https://medium.com/graalvm/graalvm-llvm-toolchain-f606f995bf
https://blog.plan99.net/graal-truffle-134d8f28fb69
You should be able to access LLVM IR directly from your Java/Scala code or vice versa, you could access your AST in JVM-based language from LLVM/C++ code using Polyglot calls.

Java Network / Socket programming tutorial [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I'm going to create a project in some month in a course I'm having and for that purpose I would like to read and try making some small test programs regarding the network / socket programming in Java.
Ideally, what I'm looking for is a tutorial with description and a end program to create where I can between two computers send and resive small and simple text messages. Don't have to be any GUI or something like that just the simple version.
I've read some articles from Sun's own homepage and in one of my Java Book but I seem to be missing the last piece of the puzzle to really understand that "network programming".
In addition, I don't know if I'm mixing things now but to my understanding can the multithreading paradigm also be applied to the network / socket programming.
Therefore, my question is, if anyone knows about a good tutorial or educational link for me to get an overview of this topic. I’m not totally new to Java but haven’t got any experience in this type of programming.
Thanks
- Emil
Here is a nice sample chapter from Java Network Programing. There's also some other parts available here, and also sample sources are available.
If you'd decide to buy this book, I'd say these chapters are enough for now:
Chapter 2. Basic Network Concepts
Chapter 3. Basic Web Concepts
Chapter 4. Java I/O
Chapter 5. Threads
Chapter 6. Looking Up Internet Addresses
Chapter 7. URIs and URLs
Chapter 9. Sockets for Clients
Chapter 10. Sockets for Servers
Don't bother about NIO yet; it's quite advanced.
In addition, I don't know if I'm
mixing things now but to my
understanding can the multithreading
paradigm also be applied to the
network / socket programming.
Yes, indeed it's a very important aspect. You'll find out why once you've read the sample chapter.
Have fun!
I've only read the C version of this book, but likely Java version is going to be equally short and good: Calvert and Donahoo's TCP/IP Sockets in Java: Practical Guide for Programmers. Even if you learned socket programming in C, you could probably adapt to Java's implementation fairly quickly.
For basic steps you might wan't to read this tutorial Sockets programming in Java. In this model the most people used one thread to handle one network connection.
In java 1.4 NIO was introduced, this makes intros a bit more complex: Java NIO Tutorial.
NIO allows to use a Selector which allows you to handle many connections in one thread, which leads to higher performance.
There is no universal book for this kind of learning. The best bet is to start with java's own tutorial on sockets/threads etc here.
By encountering problems once you start the implementation it is then you will start learning, preferably by visiting SO again and asking a bunch of specific code questions.
from my experience and in my opinion, when you want to learn socket programming at the level of abstraction provided by the Java Network API and for any language for that matter, you also have to be familiar with i/o and threads. there are a lot of tutorials out there, i suggest you grab a book. just a thought!
If you want a simple, uncomplicated and easy-to-understand introduction to networking, I will strongly recommend that you read: Introduction to java programming 9th edtion by Liang Y. Daniel. Chapter 33 is networking, and chapter 32 is multithreading.
This book is very good. almost all i know in java, I got from that book. In that book, complex ideas are made very easy to understand. sorry i could not get the link for you. You can google it.

Beginner Java Applications? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I have learned that the best way to learn a language is by finding a good project to start on, and working out how you would create it. I've been programming for 4 years as a hobby, and it's only been in PHP, so I decided that I should learn a "real" programming language. I have tried C++ in the past, however I was never able to find a project that I could apply it to, and therefore I never really learned much.
Now, though, I'm checking out Java, and so far I really like it. My question for you is: What would be a good project or projects for a beginner to learn the main features of Java? I understand basic OOP practices and such. What I really want to learn is all the little libraries and functions inside of it. For example, in PHP you learn to use many array manipulations and other functions built-in to do work for you. I would like to learn what these are in Java.
As I said, I don't really want just documentation, I'd like a project that I can apply Java to.
Whenever I learn a new language I start with a Mandelbrot. Just to get the hang of loops, variables and drawing.
Many other simple learning progs are possible. For basic screen/key/mouse i/o and timers, try a Tetris, Breakout, or Clock/alarm clock. To learn audio interface make an Electric piano/synth. To learn maths/recursion/string manipulation i often write a quick expression parser + graphing prog. To learn sockets, you could try a simple p2p chat.
Java is a good choice, good luck!
My advice, take a project based course some university puts up. Something past COMP 101, but not too theory heavy.
This one's how my university breaks sophomores. Its fun, and requires you to think about design and (a little) about data structures. Good "salt of the earth" programming: consoles, file IO, parsing, collections, etc. No GUI, though there's another project for that and threading.
dont rush urself, get a good java book and study from the chapter 1st and make sure you solve all the exercises of each chapter. First get ur basic / foundation strong, then u can think about how to apply that knowledge in project. And make sure u also get a good book about algorithm. If you had an experiences in php for 4 years, you must developed something with php i can assume, so try to develop same application with Java now, it will give you good insight about Java. And one thing... try to focus on how you can write good quality code! Anybody can write code but good quality code is rare, focus there.
while general, I would say find a web application that interests you. If you are familiar with PHP, you are probably familiar with many web technologies. Java on the server is a nice alternative to PHP, and deploying a Java web application is pretty simple.

Rapid switch to Java for an experienced C++ developer [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm am looking for online tutorials/books, which assume a solid knowledge of OOP/Design patterns concepts and stress on differences (both conceptional and syntactical) between C++ and Java thus allowing for a rapid development in the latter.
Thank you very much in advance, appreciate your time.
I moved from C++ to Java 6 years ago an used "Effective Java" by Bloch, this is a style book which explains in 50 short articles how best to use various java classes and techniques. This is very similar to "Effective C++" by Meyers and "Exceptional C++" by Sutter.
If you already know C++ and object oriented programming and can read Java this is the fastest way to write good quality java code.
There is a new edition out now with generics etc. In my mind this book is essential for all Java programmers as well as those wanting to learn Java.
The Java Tutorial.
It is kept up to date and well written. Also available in hard-copy.
I'm always skeptical about "change from X to Y" guides. Though they may help as reference points afterwards, learning a new language by coming from another one may be tricker than you think.
I think it is important to learn the new language "as designed" and to get the feel for the way to things "right" in this language and also learning its code idioms.
As a good book for experienced programmers who also want to learn about potential pitfalls of Java, I recommend Effective Java.
O'Reilly's 'Head First' books are very well written. Take a look at Head First Java and Head First Design Patterns.
I made this transition in 1996 or so when Java was newish. A book will definitely help. I used Laura Lemay's 21 day book, which is now up to rev 6. It took me 3 days to get through the original book and another week before I felt I was fully conversant.
Things to get used to:
The language is not huge, but the support libraries are. There probably is already something that does what you want
Garbage collection and sane memory management is awesome. My bug count plummeted in working with Java compared with C++
Garbage collection and sane memory management sucks. I was writing performance critical applications and (at the time), I would've killed someone to get something similar to placement new or operator new overload.
Garbage collection is not general resource collection (ie, open files etc). You still need to worry about that.
I really missed having an integrated macro preprocessor. You can still use one, of course, but then your build has just gotten more complicated.
Avoid head first Java. It is low signal to noise. Nutshell is good but has become huge, like the language.
If you are an experienced C++ developer, I would recommend skimming through the Java Tutorial (as mentioned by Gerd Klima). Then, just open up the Java API documentation and jump right in, feet first.
When I did (sort of) this, I used O'Reilly's Java in a Nutshell. It now seems to be more like "Java in an intermodal shipping container" though, so perhaps it's not as quick anymore. I would still expect it to be decent, I think it's more reference material nowadays.
There are several books covering "Java for C++ Programmers" on Amazon.
You definitely need a book, and there are many out there.
Beyond that, one thing that helps, IMHO, is a cheatsheet, that you can print and put up next to your monitor. As you learn stuff you can add them to the sheet.
Here are a couple, specifically for C++ programmers:
http://www4.ncsu.edu/~kaltofen/courses/Languages/JavaExamples/cpp_vs_java/
http://www.cprogramming.com/tutorial/java/syntax-differences-java-c++.html

What are the most important things to learn about Java Programming? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I have a good understanding of object oriented programming but it's been a while since I programmed. I want to learn it again. What are the most important aspects of Java programming that are important to learn so I can identify myself as a programmer. I had trouble learning Swing before and I gave up but I want to try it again to learn it. How many years does it takes to be a good programmer?
Some things may have changed since you left the language, here some personal proposals:
Servlets and JSP, you should take the dust off to this and include some EL (Expression Language)
A build tool (Maven or Ant), most of Java application are now built with the help of them.
Any Web Framework (Spring MVC, Struts2 or JSF are good choices)
IoC and ORM (Spring and Hibernate are good choices)
Take a look to Apache Commons and use them when possible
Also some features from Java 5+ like:
Annotations
Generics
One very important aspect is to learn the best practices of the language. One way to get up to speed about that quickly is to read Joshua Blochs book "Effective Java". I cannot recommend it enough.
Being a good programmer isn't an issue of time so much as it is an issue of being able to perform certain tasks. Swing is certainly something you want to know if you want to make a graphics application. If you want other things to know about Java, learn how to use the collections framework, which defines different data structure interfaces in Java. Of course, learning how the data structures work and making them from scratch is nice. Other than that, it really depends on what you're going to be developing. I have found java.sun.com's API to be invaluable
I believe that practice is the most important aspect. Books give you "a map", and it's difficult to start without a map, but until you explore the territory on your own, you can't really understand it. So, pick any project that interests you, and just go ahead and implement it.
Regarding how many years does it take - see Teach Yourself Programming in Ten Years by Peter Norvig.
I wouldn't say it takes years to learn it. You just have to write code, and learn from your mistakes.
Learn the core language well and then learn about best practices.
Understand the limitations of the language and look for ways to improve on this. Apache Commons is a good source of knowledge for this.
After that, understand and learn concurrency with Java and the underlying memory model.
If you need to learn a GUI framework then look at Swing or Eclipse SWT.
If you need to learn a web application framework then pick one of the hundreds out there. I suggest looking at SpringMVC or Struts 2.
Pointers. Go back to C and learn pointers.
(almost) Everything in Java is a pointer, so if you don't understand them, there's no use in any of those fancy frameworks.
In my experience the Java Tutorial is a good online resource for entry level programmers, as it is very clear in what it wants to say.
The "Head First Java" book is also really good (even though it doesn't look like it). The colloquial style is just a facade - there is hard core knowledge in there.
Of course you need to learn the basic features of Java before learning anything else.
Of the "advanced" language features, I would pick reflection.
For the GUI, there are several options. I would still pick Swing, since it is the most common tool.
For the web, learn servlets and JSP (so you know the basics), then learn a framework (struts, JSF, etc.).
There is no clear cut favorite in my opinion.
I'd get a good beginners java book and go through it. A good free one is Thinking in Java http://www.mindview.net/Books/TIJ/. I'd also recommend getting a good IDE like Eclipse or Netbeans. If you want to do web development you can find some good tutorials on struts2 or JSF.
I would start with other APIs besides Swing, unless you have a real nead for it. Apache Commons has several components, like daemon starting, logging, IO, application launching, db connection pools... And the best part is, the source is there for you to read.
Some other things to learn: how some of Java itself works. Hunt down souce code (Suns, an opn source, it doesn't matter), look at classes like StringBuffer, and see how they work.
Good luck space cowboy!

Categories