I need to learn Java

Nachohat

je suis donc je pense
I'm a pretty good C++ programmer and I would like to learn Java. These two languages are very similar and I don't have to learn everything from scratch. Are there any good sites with tutorials where I could learn Java reasonably fast?

I found this so far : http://java.sun.com/docs/books/tutorial/

But I would prefer something that really assumes that you allready know how to program. I don't want to have to skim through all the basics to find something new for me.

To all the programers out there, how did you learn Java?
 
I've been programming in Java almost exclusively since late 1995, when the 1.0 JDK was still a beta if I remember correctly. Before that, I programmed mainly in C and during a brief dark period in my life, Visual Basic. Since I started in Java during the early days, there weren't nearly as many resources available as there now are. Some suggestions:

- Get a copy of JBuilder, but make sure you have plenty of RAM. It's a pure Java application and can be memory intensive.
- Grab copies of the Java In A Nutshell series from O'Reilly. These are great quick references to the APIs. I'd start by getting Java In A Nutshell, Java Foundation Classes In A Nutshell, and Java Examples In A Nutshell. The first one mentioned contains a very brief tutorial/comparison that is targeted at existing programmers who are learning Java. These a good references to keep nearby no longer how long you've been programming in Java.
- Consider grabbing the book Effective Java Programming Language Guide. Its essentially a series of good practices to put into use, and is a nice book for both new and experienced Java programmers.
- Visit sites like JavaWorld.com.
- Sign up for Sun's Java Developer Connection and their weekly Java e-mail. Start at http://developer.java.sun.com. You'll find loads of tips and articles here.
- Investigate some of the Java publications such as Java Pro, Java Report, and Java Developers Journal. Java Pro seems to include more complete examples.
- Explore the Java newsgroups. If I remember correctly, they are in the hierarchy comp.lang.java.*
- Check out the website www.gamelan.com.
- If you plan to develop Java applications that will be deployed on the Macintosh, check out the Java developer mailing list available from Apple. Here you can find answers to platform specific issues.

These suggestions should, through exploration, get you on a good track and help you to find additional resources. Hope you find them helpful.

- Mike Connick
 
Wow Mike!! Thank you very much for the very lengthy post! Learning all this will take me years.

I'm still a student though so I'm just doing this as a hobie. And I have many hobies at that. I have gotten the Java in a Nutshell book at a second hand book store and it's pretty good. It will get me started that's for sure.

I love Java, but I don't quite see the advantage of using it over C++ in OS X. Yes, it is very cross platform but damn the load times are slow. In a few words, what are the main advantages of using Java over C++ in a single platform product?

I have so much to learn it's unbeleavable. School is just the tip of the iceberg. :eek:
 
School is certainly just the tip of the iceberg, especially in an ever-changing industry. You can never stop learning as a software developer. Java was at most a twinkle in James Goslings' eye when I was in college 10 years ago (boy, time flies), look how quickly it's become one of the dominant development languages.

Regarding advantages of Java over C++ for a single platform (like OS X), that's not the real question to think about (and don't let anyone try to convince you otherwise). Don't ask what language is best for what OS. Ask, of the languages available to me, which is best to achieve the task I am presented with. Java and C++ each have their advantages for specific tasks. Without knowing a specific task, it's nearly impossible to recommend a language or other tool.

For me, Java is important for the cross-platform capabilities. My company develops educational software, and our products must run on Macs and PCs. Java allows our very small team to deliver high-quality products for both platforms very quickly. That makes it the best language for our tasks. Since I'm a Java enthusiast, I'm glad to be able to use it.

Although I have noticed that Java seems somewhat sluggish in OS X right now, I expect the performance to increase substantially. Apple has a lot on their plate right now, and I have confidence the performance of Java in OS X will improve.

Take care,
Mike
 
Yah, I read that java performance will be improved in 10.1.

I'm a college student, and I'm just starting to learn Java too... my computer science class is great but it's moving really slow... some of this info (maybe some books n' stuff) will help me go at a faster pace. Thanks.

...Here's a question... what would some of you recommend for software to start doing Java on my Mac? (Right now I'm doing everything on PCs in a lab... :p)

...the only package that I know of is Codewarrior. Is it good? Are there any other good ones?

Thanks!
 
Project Builder supports Java... at least in Cocoa. Check the developer tools for more information about Java developing. There is also a MRJAppBuilder application in the developer applications folder.
 
I'm in computer engineering and I'm specialising in hardware but I'm realising now how much I love to code. At least you can learn software on you own, don't even think about doing that for hardware though.

I use Codewarrior myself. I find project builder is just too damn slow for the moment although I haven't gotten the chance to get the latest version, I will when 10.1 comes out.

Mike, do you own a software company? I would sure like to start one after I get a bit of experience in the area. Right now I'm on my coop work term and it's a great break from studying. It's a completely different world out there.
 
I love java :)
Learnt it 2 years ago ;) I am doing prorammin in ANSI C now :eek: ... damn computer science department lol

Java is really easy to learn and no idtioc stuff like C where you have to alot x amount of memory for stuff like arrays and do garbage removal manually. java rocks!
 
What does everyone think about the new C# that Microsoft is trying to push instead of Java... and about the fact that a virtual machine will not be loaded on XP? Will software developers require an install of a Sun Virtual Machine with every install like many programs require Quicktime or DirectX?
 
Regarding Microsoft not including a Java VM with XP, it is not unexpected but still slightly disappointing. Microsoft's business practices really upset me to the point where I dislike using their products anymore than I have to. Since the early days of Java, they have done a number of things to attempt to hamper its adoption. Many of us know those things, so I won't rehash them.

However, I don't think Java developers should really consider Microsoft's failure to include a Java VM in XP as a big deal. We knew they weren't Java advocates, and it's easy to bundle a Java VM with a Java application. I use a product called InstallAnywhere (www.zerog.com) to do just that, and have done so even when Microsoft did include a Java VM. This is seamless and does not require any step on the part of the user. Products like Java Webstart (a Sun technology) should also help with such issues.

Why have I always installed a Java VM with our product? Because it allows me to control the Java VM that is running our program without replacing any Java VM the user might already have installed. There are differences between Java VMs, and you should learn about them if you're going to develop commercial software in Java.

For instance, although Sun's Java VM version 1.3 for Windows is quite fast and good at managing memory, we cannot ship it with our product. Why? Because of nasty bugs related to anti-aliasing of text. As a result, we ship IBMs Java VM for Windows with our product, which is not as good about managing memory. When Sun's Java VM version 1.4 comes out, we will test our product under that VM and re-evaluate our decision.

It's also very important to test the virtual machines on all the platforms you plan to deploy on, even if there isn't a choice of Java VM vendors. Does the Java code I wrote on a Windows machine run on a Mac? Yes, under MacOS 8.1 and higher as well as OS X. Are there platform differences you must accomodate? Yes. There are times where you must check what OS you're running on or what Java VM version is running, and have your code address that. Write once, test everywhere.

Regarding C#, I think its timing is such that it will have minimal impact on Java. Java has had a 5+ year headstart on C# and is now quite well established. Java also has the backing of most other major players in the software industry outside of Microsoft. I don't see compelling benefits to C# over Java, except for those developers who like the comfort of a Microsoft-centric world.

The above said, Microsoft has done some great work on Macintosh products lately. I've looked at the Office package for Mac OS X, and it seems quite impressive. I will probably buy it and use it rather than Appleworks (which I did purchase) because it is easier for me to interact with coworkers and their documents by using Office. Internet Explorer 5.1 for Mac OS X 10.1 seems quite stable, although I generally use Opera, OmniWeb, or Netscape 6.1 in OS X (yes, I am using IE right now).

- Mike
 
Originally posted by AdmiralAK
Java is really easy to learn and no idtioc stuff like C where you have to alot x amount of memory for stuff like arrays and do garbage removal manually. java rocks!

Be very careful in what you assume about Java and garbage collection. Although you don't deal with memory in the same way as you do in C (alloc, free, etc.), there are things you should do. You should:

- make sure to call the dispose() method on objects that use system peers, such as windows
- make sure to call the flush() method on Image objects
- make sure to set objects you will no longer be using but do not quickly fall out of scope to null
- call System.gc() to ask the system to do a garbage collection when you know you're eating up memory (calling this method does not guarantee garbage collection will occur, it is only a suggestion to the virtual machine)
- some other things I'm too tired to think of right now

If you don't do these things, you may find your program running out of memory. For instance, under Apple's Macintosh Runtime for Java (MRJ) for what are now called the classic versions of the OS (9.2.1 and below), it didn't release memory used for images readily. From what I understand, that was because it used a different heap for images than it did for other Java objects. If you wrote good code and the heap for other Java objects wasn't filling up, the garbage collector might not get called and the image heap would get eaten up. To work around that, you had to do the things I mentioned above.

- Mike
 
Originally posted by Nachohat
Mike, do you own a software company? I would sure like to start one after I get a bit of experience in the area. Right now I'm on my coop work term and it's a great break from studying. It's a completely different world out there.

My day job is for an educational software company. We were purchased by another company during May of this year. I manage the operations of our small satellite office (our main office is out of state) and continue to develop in Java on a daily basis. Our office is a nice situation, because there are only "developers" there. I use the term developers in the last sentence to mean anyone who contributes to the development of a product, and not just coders.

Prior to May, we were an independent company of which I was one of the founders and the Director of R&D. The company that bought us is the one I courted, so I am quite happy with the outcome.

I also have a night time project I'm working on that I hope can be turned into a company once I complete the prototype. It's a much tougher market to go out on your own and do something interesting these days than it was a couple years back. I wouldn't even consider it without a good, working prototype to generate interest.

- Mike
 
Originally posted by HECTORdaBIZATCH
...Here's a question... what would some of you recommend for software to start doing Java on my Mac? (Right now I'm doing everything on PCs in a lab... :p)

...the only package that I know of is Codewarrior. Is it good? Are there any other good ones?

Rather than name a project to develop, I'd suggest some goals you should achieve by doing your project. These will help you in a number of ways in other projects.
- develop a program that utilitizes many of the main Swing (JFC) components, such as windows, dialogs, menubars, text components (these range from simple to complex), buttons, etc.
- with those components, learn to program for the Java event model
- properly use layout managers, don't hardcode pixel positions

Quite a bit is involved in just those few things (tired, probably fogetting something critical), but knowing them will allow you to build a basic interface shell for any application you might want to develop. And the rest of your code is all about APIs and algorithms, which isn't all that different from other languages like C and C++.

Of course, if you're going to do server side stuff or things without an interface, you can ignore those suggestions.

As far as a development package, I use JBuilder 4.0 from Borland. There is now a 5.0 version, but I didn't want to switch mid-project. They have a free version available for download, but it can only be used for non-commercial projects. Be aware that JBuilder likes memory, lots of it. A relatively fast machine is helpful too. I am looking foward to the release of the 5.0 version for Mac OS X so I can turn my Windows development machine off for the last time. I don't know much about CodeWarrior, but have heard it's good.

- Mike
 
I can see you REALLY like Java with all those posts :D Thanks for all the insight. Finally, I also picked up a copy of Cocoa by Oreilly to learn better how to code for Mac OS X.

You're doing exactly what I would like to do in 10 years time (after I get my PHD and more experience hehe :D ) Starting my own company is my dream. It's hard at first, you need to have some sort of incom to survive, that is why I think you are making a good choice to keep working while working a bit on your own. Of course it takes more time and it is hard work, but at least you won't be eating bread crums for the first few years.

I think a good market right now is games. Not 3d games, god that takes a huge amount of resources, but 2d games on handheld systems. Game Boy Advance seems perfect. Imagine that you make a game, sell 50 000 copies of it for a cost of 40$ each. Lets assume that you make 10$ a copy, that's a cool 500 000$ and it shouldn't take you more than a year to make the game. The hard part is to find a publisher though, maybe I can work for one, that'll break the ice :D
 
I got a question. I've been using NetBSD since I was 13 on my LCIII. Currently I work for a major insurance company and I have noticed that a large majority of companies like you to know RPG for AS/400 and COBOL. Im currently going to take classes to address these, but also JAVA is kinda something that my company wants also. Maybe this is a dumb Q..but what is the difference between Java and Java2? THe last time I programmed was when I was 16 and that was in C for UNIX and some cheesy BASIC on the Mac under 7.1/7.5


thanks ericb
 
The best language for developing applications on any UNIX varient is C. UNIX is written in C. C is the best structured language there is. There is nothing special about Java as a language itself. It has its own complications that programmars need to be aware of or they will stuff their application. Java has one thing going for it that makes it special. That is a set of standard class librarys for doing stuff like graphics. But that all runs as non native code so its slooooow. someone port them to C/C++ then you'll see their worth.

Computer Science teachers have a lot to answer for believing the hype of java and not correctly instucting students in a low level language like C. Knowing C gives a individual a understanding of computer memory data structures. I employ programmars and as a programmar I am disgusted at the lack of fundamental knowledge of what a computer is and what you can do with it. I blame Java's over hyped. How can you program in java well without knowing a structured language like C well.

Sorry bout the rant. Just finished interviewing 20 people for a programming position. All crap. Do they just give out degree's?!?!?!?
 
mrJohns: Why do you praise C so much? I don't know much about C, all I know is that the equivalent of new and delete in C++ is malloc and free. C++ is C with object oriented capabilities. Isn't C++ much better than C?
 
Back
Top