Hello guys!!
So, you want to program in Java? That's great, and you've come to the right place.
Learning java can give you headaches if you are a beginner. Why? Because before starting to learn Java programming, you need to prepare your machine. You need to install everything you need for java programming, making it suitable for coding in Java language. But don’t you worry…we will arm you with all the tools you need to get started, including this renowned Ultimate Java Tutorial for Beginners.
First off, some introductions. Java is a high-level, object-oriented programming language developed by Sun Microsystems. Learning Java has its incentives, as it’s a powerful language for developing desktop applications, web applications, and many smart devices run on Java. Java is also a platform-independent programming language, highly portable. If your computer runs on Windows, Linux or Mac OS, they all are same for Java because it runs on virtual machine.
Let’s get your hands dirty with this IDE thing. The IDEs (Interface Development Environment) take care of all the creating and compiling of jobs for you behind the scenes. They takes your code, create the java file, launch compiler to arrive at class file, and let you run your programme. Here is a list of some quality IDEs like:
Give name to your project for example: FirstProject.
Click next, then click Finish. Then, right-click on the Project folder in the upper left, hover over ‘New,’ then click ‘Class.’ Name your Class anything you want, such as ‘firstproject’. Now look for the box that has Eclipse ‘create the main method,’ and make sure that this is checked.
The New Java Class dialogue box opens up:
Select Java under Categories and Java Application under Projects. Once
you click on Next we have a New Java Application dialogue box:
In the project name area, type the name of your project, and in the Create Main Class box name the class with the .Main extension. In the above example, we have a project “FirstProject” and with class as “firstproject.Main”, click Finish and NetBeans will go to work and prepare the workspace for us, with an in-built text editor for us to write our codes. A screen shot of the work space of the NetBeans is provided below:
So, you want to program in Java? That's great, and you've come to the right place.
Learning java can give you headaches if you are a beginner. Why? Because before starting to learn Java programming, you need to prepare your machine. You need to install everything you need for java programming, making it suitable for coding in Java language. But don’t you worry…we will arm you with all the tools you need to get started, including this renowned Ultimate Java Tutorial for Beginners.
First off, some introductions. Java is a high-level, object-oriented programming language developed by Sun Microsystems. Learning Java has its incentives, as it’s a powerful language for developing desktop applications, web applications, and many smart devices run on Java. Java is also a platform-independent programming language, highly portable. If your computer runs on Windows, Linux or Mac OS, they all are same for Java because it runs on virtual machine.
High-level overview of Java
Java is a general-purpose, object-oriented language that looks a lot like C and C++. Its design, however, was built on those of its predecessors, making it easier, safer, and more productive than C++. While Java started out as a niche language for developing applets or small programs that run in Web browsers, it has evolved to arguably become the most important programming language for developing e commerce and other Web-driven applications. Its area of use is growing daily and includes dynamic Web-content generation with servlet technology, the building of business components with Enterprise JavaBeans, the creation of cross-platform user interfaces with Swing, and much more. Portable, distributed, multitier, object-oriented programs driven by the Web are the order of the day, and there is no language better than Java for writing these programs.The Java Virtual Machine
Let's take a look at a central component of the Java architecture, the Java Virtual Machine (JVM). The JVM is what gives Java its cross-platform functionality and many of its security and safety capabilities. The JVM is basically an abstract computer implemented in software. I'll focus mainly on its instruction set, which is called bytecode. Bytecode is an intermediate language between Java source and the target computer you want to run on. The following figure demonstrates how it works at a very high level.- Programs are written in Java and stored in
.javafiles (for example,MyClass.java) - The
.javafiles are compiled by the Java compiler into bytecode and stored in.classfiles (for example,MyClass.class) - The JVM loads the bytecode (the
.classfiles), performs some checks on it, and then converts it to the machine code of the target platform that executes it
Setting up Java on your system
The first thing you need is the Java Software Development Kit or SDK (formerly known as the Java Development Kit, or JDK). This is a set of software and software tools supplied by Sun that includes all of the basic components needed to build Java programs. If you don't have this, you'll need to download the Java SDK from Sun (LINK).Now, what’s the next step in java learning?
Let’s get your hands dirty with this IDE thing. The IDEs (Interface Development Environment) take care of all the creating and compiling of jobs for you behind the scenes. They takes your code, create the java file, launch compiler to arrive at class file, and let you run your programme. Here is a list of some quality IDEs like:
- Eclipse – a free, popular program.
- Netbeans – another free program; it is open source and available in many languages.
- Jcreator – A for-pay program that provides a bit more power than most other IDEs.
1. Eclipse
Download and install the eclipse. Once you initialize the eclipse, it
will ask for workspace. You may use the default one, or may specify the
desired path. All the files generated during java programming will be
stored in this workspace.
When you have the Eclise interface window
open, go to ‘File,’ and then click ‘New Java Project’. The “Create a
Java Project” dialogue box appears as shown below:
Give name to your project for example: FirstProject.
Click next, then click Finish. Then, right-click on the Project folder in the upper left, hover over ‘New,’ then click ‘Class.’ Name your Class anything you want, such as ‘firstproject’. Now look for the box that has Eclipse ‘create the main method,’ and make sure that this is checked.
The New Java Class dialogue box opens up:
The workspace will be created by Eclipse for you to write codes. A snapshot of the Eclipse workspace will look like this:
2. NetBeans
Download and install the Netbeans. With your first run, the screen will look like this:
To start a new project, click on File then New Project. The following dialogue box appears:
In the project name area, type the name of your project, and in the Create Main Class box name the class with the .Main extension. In the above example, we have a project “FirstProject” and with class as “firstproject.Main”, click Finish and NetBeans will go to work and prepare the workspace for us, with an in-built text editor for us to write our codes. A screen shot of the work space of the NetBeans is provided below:







0 comments:
Post a Comment