Monday 19 September 2011

Java tutorial for beginners


In the last Java tutorial for beginners i told you how to install jdk. Now in this Java tutorial for beginners we will write our first program and run it using cmd.

Lets start our fourth Java tutorial for beginners ,first open your note pad and write the following program.


After writing the program save it with .java extension.For example you can save this program like javatutorial.java or helo.java or myfirstprogram.java etc. You will save this program in folder with variable name which you creat in your last java tutorial for beginners. After saving the program open command prompt and type this command cd \ like shown below.


It will take you at very start of your hard drive. Then type dir in command prompt and press enter. It will show you the list of file that your c drive have. There you will see One my folder called test as shown below.


Then type cd test, it will change your directry to test. Now we are in test folder like below.


After doing this you will again type dir and press enter. You will see your file which you have created with .java extention. I have created with youtube.java as you can see below.


Now how will you compile youtube.java? It is very simple to simple, go and type javac youtube.java in command prompt as shown below.


After typing javac youtube.java press anter and again type dir.Now we have apples.class as shown below


What it does? it take java file and convert it in class file. remeber i name my class as apple class. Lets go ahead and type java in command prompt that means run this program and then type name of your class which is apples as shown below.


then press enter you will see output of your program as shown below.


I hope you enjoy will understand this Java tutorial for beginners and if you have any problem in this java tutorial you can email me at this azeemhafeez75@gmail.com or you can leave your comment here. I will solve all your problem which you will face in this Java tutorial for beginners





Monday 5 September 2011

Java tutorial for beginners


I hope you will be enjoying this Java tutorial for beginners. In last Java tutorial for beginners, I give you brief introduction of Java. Now in this java tutorial, I will tell you how to download and install sdk. First you will open the browser and paste this address http://www.oracle.com/technetwork/java/javafx/downloads/index.html , just click It and download the JavaFX 2.0 Beta SDK and install it. Before you download the JavaFX 2.0 Beta SDK you should download and install Java SE Development Kit (JDK) 6 Update. Once you have all done then you have downloaded java compiler. Now what is a java compiler? Java compiler allows you to transfer the code you can understand or that the computer can understand. Now click start button and click run and just type cmd. your command prompt will come up. Now type javac and press enter and nothing will work. Because we have downloaded the java compiler but when we try to use it doesn't know where it is? The screen will be look like this.

Now just open my computer and and click c drive. Here you will see program file folder, just click it and go ahead. After click program file folder there will be java folder. Just click java folder and there will jdk version folder. If you don’t see it, it means you didn’t download it. After click jdk version folder you will see bin folder. Then click bin folder there will you see a lot of thing. Just right click on any of them and go to properties. This is where java to look for your compiler, just copy location path. Now right click my computer and go to properties. The system property dialogue box will open.


Here you will click advance system setting and after clicking you will see Environment Variable button just click it


After clicking Environment Variable button you will see another window here you will click new button


Then small dialogue box will open here will be two text field. In variable name text field you type any variable name like temp, path etc.


In variable value field you will paste the path location of java compiler which you copy before and then click ok.


Now your compiler is setup and ready to run. Now click start button and click run and just type cmd. your command prompt will come up. Now type javac and press enter and now you will see a bunch of crap of popup. It means your compiler is ready to go.

So in our next Java tutorial for beginners we will write the program and run it. I hope you enjoy will understand this Java tutorial for beginners and if you have any problem in this java tutorial you can email me at this azeemhafeez75@gmail.com or you can leave your comment here. I will solve all your problem which you will face in this Java tutorial for beginners

.






Thursday 1 September 2011

Java tutorial for beginners


Background:
Java was created in 1991 by James Gosling et al. of Sun Microsystems. Initially it was called Oak, in honor of the tree outside Gosling's window and the tree name was Oak. Later its name was changed to Java because there was already a language called Oak. Why we need java platform? The need for java platform independent language that could be embedded in various consumer electronic products. The first projects developed using Java is a personal hand-held remote control named Star 7. At the same time, the World Wide Web and the Internet were gaining popularity. Gosling et. al. realized that Java could be used for Internet programming.

Why Learn Java?
Java is a programming language. As a programming language, Java can create all kinds of applications that you could create using any conventional programming language. Java applications are typically general-purpose programs that run on any machine where the Java runtime environment (JRE) is installed. Code security is attained in Java through the implementation of its Java Runtime Environment (JRE). JRE runs code compiled for a JVM (Java Virtual Machine an imaginary machine that provides the hardware platform specifications to which you compile all Java technology code) and performs class loading through the class loader(responsible for loading all classes needed for the Java program), code verification through the bytecode verifier and finally code execution


Java Is Platform-Independent:
Java is platform independence is one of the most significant advantages that Java has over other. Java is platform-independent at both the source and the binary level. Platform-independence is a program’s capability of moving easily from one computer system to another. At the source level, Java’s primitive data types have consistent sizes across all development platforms. Java’s foundation class libraries make it easy to write code that can be moved from platform to platform without the need to rewrite it to work with that platform. Platform-independence doesn’t stop at the source level, however. Java binary files are also platform-independent and can run on multiple platforms without the need to recompile the source. How does this work? Java binary files are actually in a form called bytecodes. Bytecodes are a set of instructions that look a lot like machine code, but are not specific to any one processor.


Java Is Object-Oriented:
Java’s object-oriented concepts are inherited from C++, the language on which it is based, but it borrows many concepts from other object-oriented languages as well. Like most object-oriented programming languages, Java includes a set of class libraries that provide basic data types, system input and output capabilities, and other utility functions. These basic classes are part of the Java development kit, which also has classes to support networking, common Internet protocols, and user interface toolkit functions. Because these class libraries are written in Java, they are portable across platforms as all Java applications are.


Java Is Easy to Learn:
Java is easier to learn and easier to write, easier to compile, easier to debug, and, best of all, easy to learn. Keeping the language small also makes it more robust because there are fewer chances for programmers to make difficult-to-find mistakes. Despite its size and simple design, however, Java still has a great deal of power and flexibility. Java is modeled after C and C++, and much of the syntax and object-oriented structure is similar to C and C++. If you are familiar with C++, learning Java will be particularly easy for you, because you have most of the foundation already

In next java tutorial we will start to write our first program  and learn how to run the program. I hope you enjoy will understand this Java tutorial for beginners and if you have any problem in this java tutorial you can email me at this azeemhafeez75@gmail.com or you can leave your comment here. I will solve all your problem which you will face in this Java tutorial for beginners

Java tutorial for beginners



In this Java tutorial you will learn all the basic of java. I try my fully to give you all the concept of java in this Java tutorial. Java is very easy to learn and its syntax is similar to some extent to c++. Java is a programming language. As a programming language, Java can create all kinds of applications that you could create using any conventional programming language Java was written as a full-fledged programming language in which you can accomplish the same sorts of tasks and solve the same sorts of problems that you can in other programming languages, such as C or C++. Java is platform independence is one of the most significant advantages that Java has over other.