What Is Java?
Java is a programming language developed by Sun Microsystems in 1995. It was originally designed for programming small computing devices, but was later adapted by the computer industry as a platform-independent programming language. The JAVA "compiler" produces bytecode that can be interpreted on any platform, and is free to download from Sun and is supported on many platforms including Windows, UNIX/Linux, and Solaris.
What Can Java Be Used For?
Java was originally developed for small devices. Now Java can be found in every corner: PDA's, cell phones, PC's, network devices, ecommerce systems, business applications and many more. Java is platform independent, making it perfect for internet applicatons, as the programs made in it will run on many different types of computer.
Java comes in several forms:-
- JSP, or Java Server Pages, use a form of Java code embedded in standard HTML tags to create dynamic web pages. Similar to PHP and ASP.
- Java Applets are another type of program used on the internet. Applets, or a small program that is executed from within a web page, can bring many new uses to a web browser. Things like chat clients, instant messaging, complex calculations, and much more are commonly handled by Applets.
- J2EE, or Java 2 Enterprise Edition allows third party companies to use the software to make transactions. A registry is used so that seperate companies can transfer XML structured documents between one another with ease.
- JavaBeans, according to the Sun website, are "...a reusable software component that can be visually manipulated in builder tools." A Bean is a specific component that is used when visually piecing together a program (similar to Visual Basic components). They are used in conjunction with builder tools to give modular functions to the program. A Bean is interchangeable between programs and platforms.
What Is The Syntax Like?
While Java is similar in syntax to the C programming language, it brings with it a unique style of coding. It inherits the general programming features, such as loops, conditions, data types, curly braces, and semi-colon delimited statements. Java is a fully featured Object Oriented Programming (OOP) language. This means that it supports classes, modules, inheritance, polymorphism, and many more OOP features.
An Example Java Program
This is an example of a Java source file. The code should be saved in a text file with a .java extension.
// Classname must be same as filename.
public class test
{
// Variables
private static String myText = "Hello, World";
private static String msg;
private static int myInt = 10;
// Main - Where the Action Starts
public static void main(String args[])
{
// Print "Hello, World" to the screen.
System.out.println("Hello, World\n");
// Multiplication for each value
for (int i = 0; i <10; i++)
{
// Print Calculations to Screen
System.out.println(calc(i));
}
}
// Handle the calculations
public static String calc(int timesBy)
{
// Put calculation into string
msg = myInt + " x " + timesBy + "= " + (myInt * timesBy) + "\n";
// Return Calculation
return msg;
}
}
What Do I Need To Get Started?
Java requires the necessary compiler and a simple ASCII text editor such as Notepad (standard on all Windows machines), or VI, eMacs, Kate, etc. for a UNIX/Linux machine.
Common Java Problems
Java is case-sensitive, meaning that if you name a variable MyVar, you cannot call it as myvar or mYvAr.
Forgetting to close your curly braces is another problem. It helps to indent lines inside curly braces so that the braces are aligned.
Are There Any Free Java Tools I Can Use?
You can download a free Java IDE from the
Eclipse
website or the
NetBeans website. See the
?ANT explanation for an example of how to use this free java build tool which usually is integrated with modern IDEs.
What Does Programmers Heaven Offer Me?
Visit the
Java section of the site to see articles on Java as well as source code, developer tools and links to many sites, including tutorials pitched at many different levels. If you need assistance, why not post your question on our
Java forum.
Further Reading
Amazon.com offers quite a few books on Java for you to read. A few that may interest you are:
If you're a looking for a few excellent e-books on java that are free, you can try these websites out:
There are so many free E-books out there that are Java Based that it isn't funny. But, Many times these books are a little outdated. For instance, Java is now in version 1.4, and some of these books are still talking about previous versions. So, it would be a good to also purchase a more uptodate book as well as having the knowledge that you can read more on the internet.
There are also quite a few tutorials available on the internet. Here are a few of them: