This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Dj Driver wrote:Just got my Head First Java, 2nd edition Covers Java 5.0 and have a few questions:
-I wrote my first code in a .txt file and then renamed it to .java - is that the way to start off and they way to continue?
Normally I just open a new Notepad, and save it as a .java. No need to rename.
-when I execute my java code it flashes on the screen and then goes away. How do I get it to stay on the screen so I can view it?
What do you mean "when I execute"? Are you running from a command prompt? What is the code doing? If all the code does is add 2 numbers then exit, you won't see anything. It is all dependent on the code you are running.
-is there a java editor I can use so I can see if there is an error in my code before I try to run it?
There are tons of IDE's out there, but if you are starting just get a free notepad-like program (Notepad++ is a common suggestion). It will help you with indents and formatting, but not be so cumbersome that you spend your time learning the IDE rather than the language.
When I die, I want people to look at me and say "Yeah, he might have been crazy, but that was one zarkin frood that knew where his towel was."
Welcome to the Ranch Agree with the advice to use Notepad++. An excellent app.
Joined: Nov 11, 2011
I typed up the first MyFirstApp (on page 9) to print out "I Rule!" , "The World" and ran it from the command line (Selecting Start, then Run, typing javac MyFirstApp.java and selecting OK). A box flashed open and then closed so no way for me to see anything. Do I need to enter something in the code to keep the box opened?
After selecting run type cmd and enter. In this box you can use javac and java commands. This way the box stays open and you can see the results.
A good alternative to an IDE is notepad++. After install select in the pluginmanager the explorer and exec plugin. In this way you can stay in the notepad++ window and execute the commands inside a commandpanel. With this setup you can learn the Java syntax with a minimum of switching windows.
Joined: Nov 11, 2011
From prevoius post : "After selecting run type cmd and enter. In this box you can use javac and java commands. This way the box stays open and you can see the results. "
This box does not stay open. When I type Start, then Run, typing javac MyFirstApp.java and selecting OK) that is the problem I am having.