Sunday, August 7, 2011

The thing about Java..introduction

Basically Java is a programming language. Like any programming language, you need to know the syntax of it. Programming is not difficult, the problem is when the error come out, you have to settle it.

There are many Java editors, I am going to use JCreator. To install JCreator, you need two things basically.
1. You need a JDK file that can be downloaded from Oracle website
2. You need the JCreator installer.

You need to install the JDK file first before installing the JCreator, or you will have problem building a file later.

Another thing, when a Java file is compiled, it does not create an exe file like C or C++. It creates a class file.

C++
Program.cpp when compiled will produce Program.exe.

Java
Program.java when compiled will produce Program.class.

But java has a peculiar habit where the class name MUST be the same as the file name, otherwise there will be an error when you try to compile the file.

public class Program {
public static void main(String args[]) {

}
}
This piece of java code MUST be saved as Program.java. Any other name, even lowercase program.java will give you error when you compile it.

1 comment: