The first thing that you need to do is download Eclipse, and install it. Once you install it, create a new project, and start making new file.

a) When making your new file, you need to give it any name, for example: 'JavaProblems'. So, just type into the box that asks you for a name and just okay everything. Note that java is case sensitive: "", "", "", "" and"java" are not the same!

b) The first few things you'll find on your code or have to write on your code is this phrase public class JavaProblems. With Lincoln being the name of your file. You will always have to write public class file_name in you code. file_name is the name you choose, in our case it is JavaProblems.

c) After this, just press enter, press the { key,  and press enter again.
You'll notice that a new } was made. Basically, whenever you have a { you need to also have a } to be somewhere after it, but not directly after.

d) Now that you're inside the { } you have to type this phrase public static void main (String[] args). Lots of words which you won't understand, so just shut up and memorize this. Press enter and type { again. Now that you're inside the { and the automatically generated }, you'll actually start writing your code/functions. You always have to write that phrase in your Java files. You'll find out why later.

e) Now that you're inside the second set of {}, it's time to write some code.
Let's say that you want your code to display something on the screen. What you do is that you just type in
 System.out.println("Hello JavaProblems!"); 
Write this phrase twice if you want just to get used to it and start playing around. Write many System.out.println()'s. Start having fun.

Extra: Try to insert two consecutive System.out.print() statements, and deduce the difference between System.out.println() and System.out.print() (If you fail to deduce the difference, ask Google).

f) Now, press the button on your software that says Run JavaProblems

e) You're done! This will execute the program and display on the screen the "Hello JavaProblems!" in your code. Congrats, you just coded.

Here are some little things you should keep in mind from this chapter besides the things above.


In your code, you must have seen a lot of bold colored words(for ex: public static void main). Those words (like public, class, static, etc.) are called 'Identifiers'. Basically, they are Java's vocab words which you cannot use as your own or in different ways.


Let's say that the only reason why you are making this Lincoln file is to show display the sentence 'A quote by Abe Lincoln: I am Abraham Lincoln'. You never write code without a purpose/requirement/function. So, to make sure you remember why we're writing this file, type the following:
 //display something about Abe 

And press enter. Did you notice that the color has changed? This is called a comment. We use comments to "explain the purpose of the program and describe processing steps". They don't effect our code so we can write as many comments as we want as long as we always start them off with a // for each line of code.
An alternative is to type to close it off. Try it out for yourself
 /* and write as many lines as you want (or just one)
 and then type */ 


When coding, Java doesn't give a shit about the white space or new lines you have in your code. Meaning, you can put hundreds of spaces and tabs between System.out.println("bla"); (i.e. System   .  out.println (   "bla"   );), and Java will interpret this the same as System.out.println("bla"). The only time a space will make a difference is when it's inside the ""  of the println("') statement. But, even though spaces mean nothing, you should always try to limit your spaces and maintain the same tabs that Java automatically generates (such as between { }) so that your code is readable and not annoying to the people who didn't write it.

More to come soon...

Follow Me

If you like our content, feel free to follow me to stay updated.


Enter your email address:

We hate spam as much as you do.

Upload Material

Got an exam, project, tutorial video, exercise, solutions, unsolved problem, question, solution manual? We are open to any coding material. Why not upload?


Copyright © 2012 - 2014 Java Problems  --  About  --  Attribution  --  Privacy Policy  --  Terms of Use  --  Contact