Java 101: Lesson 2 - First lines of code
Tuesday, October 21, 2008 2:59Hey, welcome to lesson 2 of Java 101, if you missed lesson 1, you can check it out here, now that you’ve got the necessary tools for making some java code we will start by doing the all time classic “Hello world” but you’ll need to know some things first:
For starters you will need to create a project, in NetBeans go to File and select New Project, After that select Java and then Java Application, just like the picture (The process is similar in all IDE’s)
After that fill the Project name and you are ready to go (By leaving the Create Main class box checked you are doing yourself a favor, just for now though)
Now you will have something like this, this is you coding environment, you’ll get used to it soon (Note: Maybe you have a package line at the beginning, just ignore this line and move on)
Ok, now, public class Main is like the project itself, as the name says is the main class, you’ll be writing your code here for now.
The public static void main(String[] args) class is like the test class, if you want to try something you’ll need to post it here.
We want to write the “Hello World” lines, so, if you want to write something in Java you can use the following sintaxys:
System.out.print(”What you want to write”); (Note: This “command” will leave the cursor at the same line, so if you write something next it will be written in the same line)
Or
System.out.println(”What you want to write”); (Note: This “command” will take the cursor a line down, so if you write something after this it will be written in a different line)
We can use either of them for this simple code, and because of the simplicity of the program just write directly in the public static void main class.
So your program should look like this:
Now click in the “Play” button (As the arrow is pointing) and your output box should look like this
Ok, you just made you first java program , its kind of stupid I know, but just keep reading the lessons and you will learn usefull things.
Don’t miss the next lesson, you can subscribe if you want to, but I don’t think you want… yet.














Computer Juice says:
April 22nd, 2009 at 9:30 pm
Great post! This is why I love blogging. Always something interesting to read, watch and enjoy. It keeps the mind active. Thanks, Amy x.
batty says:
June 30th, 2009 at 11:42 pm
this was a good tutorial i haven
Leontes says:
July 14th, 2009 at 8:30 pm
Sup? thanks a million for this great tutorial. It helped me improving my skills pretty much. It is always great to get some impressive inspiration and I hope to find more of such posts here soon because nobody will ever stop learning new things. Keep on
survey money says:
June 3rd, 2010 at 6:13 am
Thank you soooooooooooooooooo much for the great article. this was just the thing I needed today
Jeremiah Schomas says:
June 15th, 2010 at 4:24 pm
Super post – and great domain by the way:-)
Elijah Riise says:
June 16th, 2010 at 5:27 pm
Eating, loving, singing and digesting are, in fact, the four acts of the jocular opera known as individual, and they pass like bubbles of a grit of champagne. Whoever lets them contravene without having enjoyed them is a entire fool.
lenen zonder bkr toetsing says:
July 17th, 2010 at 8:46 am
BKR problemen? Nu Geld lenen zonder BKR toetsing? Op zoek naar betrouwbare aanbieders? Wij vergelijken banken die u toch kunnen helpen aan een betrouwbare
migraine says:
July 25th, 2010 at 3:42 am
Migraine is niet zomaar hoofdpijn. Migraine kan je leven totaal ontregelen en verzieken. De dreiging van migraine hangt dagelijks meer dan 10% van alle
lenen says:
July 30th, 2010 at 11:25 am
Lenen zonder BKR toetsing gaat vandaag heel gemakkelijk. Binnen een paar uur geld lenen zonder BKR toetsing doet u hier, lees snel verder
Robbie Squire says:
August 13th, 2010 at 4:47 pm
It is humdrum how jokers don’t detail a no sweat topic like this.
Omega Ruhland says:
August 13th, 2010 at 7:34 pm
You know, I have a leaning about .
Silver Eagle coins says:
September 2nd, 2010 at 2:15 am
Hi there, I find that your published content is rather observant as it talks about a good deal of good info. Anyway, was thinking whether you would want to exchange web links with my web space, as I am looking forward to build web links to further amplify and make headway for my web portal. I do not mind you setting my contacts at the sitewide page, just approving this links on this page is good and enough. Furthermore, please be kind enough to contact me at my web space if you are keen in the link exchange, I would really value that. Best wishes from me and I hope to hear from you soon!
biozone air purifier says:
September 3rd, 2010 at 4:49 am
I thought it was going to be some boring old post, but it really compensated for my time. I will post a link to this page on my blog. I am sure my visitors will find that very useful. . . .
Affordable Web Hosting says:
September 5th, 2010 at 10:25 am
Cheers for sharing this blog post.
financial spread betting says:
September 5th, 2010 at 2:14 pm
If the underlying share price moved disastrously against you overnight, for example, you might lose the whole of your investment if you had bought the share. However, if you had placed a bet on the share and you had imposed a guaranteed stop-loss limit, you would limit your loss to a predetermined amount. A stop-loss is exactly what it is called - a limit to the amount you might lose. On the other hand, there is no limit to the amount you might win. Financial spread betting provides a simple, tax-free* way to profit from rising and falling prices on a range of different markets. As a world leader in spread betting for 35 years, IG Index is the UK’s largest and longest running financial spread betting company. With IG Index you can take positions on forex pairs, global stock indices, over 7000 shares, commodities, binary bets and more Financial Spread Betting is the most efficient leverage tool for traders, in the financial markets. Traders have the opportunity to trade with no real ownership in the market. Explore the Financial Spread Betting markets and learn how to trade successfully.As current or future investors you are well aware of the fact that in order to trade in the financial market you need to own or be a part of it as far as investment of money goes. With Financial Spread Betting the story is different.This is your chance to get involved in the stock market or in any other financial market with a value such as gas, oil gold and so on, without actually being invested. This is not only convenient financially but also requires less effort as far as bureaucracy goes.So what is Financial Spread Betting anyway?Financial Spread betting enables the trader to lay an over / under bet with the ability to minimize the risks and optimize the profits by ending the bet as soon as it goes the other way around from the bet (stop loss) or getting out while you are ahead.Financial Spread Betting is available for various products including shares, currency exchange, commodities and just about anything with a value.The spread is the difference between the bid and the offer price for example taking the apple stock and placing a bet that it will rise (go long) and it indeed rise, then you will get your bet times the number of points it went up.Financial spread betting is gaining popularity in Europe and mainly in the UK. Even though it existed for years, it is now becoming available online and much like other new trends online, many companies are seeking the opportunity of catching customers by offering lucrative incentive offers such as welcome bonus.
Elenor Durun says:
September 7th, 2010 at 7:58 pm
hey there, this might be little offtopic, but i am hosting my site on hostgator and they will suspend my hosting in 4days, so i would like to ask you which hosting do you use or recommend?