| By Kenrick Freemen | Article Rating: |
|
| January 8, 2013 03:04 PM EST | Reads: |
2,283 |
What is Java?
You can find tons of definition about Java on web; my answer is simple “Programming Language to develop any kind of application with Object Oriented approach and it can run anywhere”.
Sample application
For example, you need to develop an application to track your daily expenses on your PC. The application can be developed by Java by the following manner.

Minute 1 Session
First download and install Java Development Kit (JDK) from official Oracle site. The JDK is the software environment where you can compile and run your Java programs. Download here.
Minute 2 Session
Know the commands to compile and run a Java program. Before that you need to set the path to point your Java compiler on your development location. Assume that you have installed JDK on your C:\Program Files\Java\jdk1.7.0 drive. You need to run the following line of code in your command prompt before accessing Java compiler.
SET PATH = C:\Program Files\Java\jdk1.7.0\bin;
Open start menu and type cmd on your Windows machine to open command window. Now open your folder where your Java programs are saved.
For example: D:/MyJava.
Cd D:/MyJava
D:MyJava > SET PATH = C:\Program Files\Java\jdk1.7.0\bin;
Note that “jdk1.7.0\bin” folder contains Java compiler (javac) and Java interpreter (java) applications.
Now you are ready to run a sample Java program on your machine. Unlike like regular hello world application, we are going to run a practical program to track daily expenses.
Minute 3 Session
Just learn about simple Java program and know the basic steps to compile and run a program.
A Java class is a blueprint of an object. An object in an instance of a class.
Step1: Identify Java classes
Step2: Develop Java classes
Step3: Develop main class
Step4: Compile all classes
Step5: Run main class
Main class is a Java class which has interpreter calling method named main like below:
public void main(String args[]){ // main method to run a Java program
// Code to call other objects/classes
}
Minute 4 Session
In our case, we need to develop an application for daily expense tracking. The following classes may satisfy these requirements.
ExpenseTracker
ExpenseTrackerMain
Minute 5 Session
Develop ExpenseTracker Java class.
public class ExpenseTracker {
public void addExpense(String expenditure, double amount){
System.out.print(“Expenditure ”+ expenditure+” “+amount+” added on ”+new java.util.Date());
}
}
Save this file as ExpenseTracker.java in your working folder.
Minute 6 Session
Develop ExpenseTrackerMain class to run this application.
public class ExpenseTrackerMain {
public static void main(String as[]){
ExpenseTracker tracker = new ExpenseTracker();
String expen = JOptionPane.showInputDialog(null, “Expenditure”);
String amount = JOptionPane.showInputDialog(null, “Amount”);
Double doubleAmount = Double.parseDouble(amount);
tracker.addExpense(expen, doubleAmount);
}
}
Minute 7 Session
Compile your application. Just open your working directory where you saved these .java files and follow the below steps.
Open command prompt and go to your working directory.
Type SET PATH = C:\Program Files\Java\jdk1.7.0\bin; // recall Minute 2 session
Type javac *.java
This command will compile both ExpenseTracker and ExpenseTrackerMain Java files. This action will generate .class files inside your working directory.
Minute 8 Session
Run your application.
Open command prompt and go to your working directory.
Just type java ExpenseTrackerMain in your command window.
Minute 9 Session
Your first Java program is done.
What is next?
Just add some methods in ExpenseTracker Java file, call those methods in ExpenseTrackerMain class, compile and run again.
Minute 10 Session
Similar to Expense Tracker application develop Task Tracker application by using the following code snippet.
public void addTask(String task, Status status){
System.out.print(“Task ”+ task +” added on ”+new java.util.Date()+”. Status of this task is :”+status);
}
What is next?
One of the best ways to develop your Java knowledge is by Oracle’s Java Certification program. There are numerous vendors available to teach Java in the world but there are few vendors are having good knowledge and latest updates.
You can find best Java Certification Training Labs from EPractize Labs, leading Java Certification Preparation website for all Oracle’s certifications including latest Java 7 and Java EE 6 OCE certifications.
The following Training Labs teach beginner to expert level in Java 7 programming.
1Z0-803 - Oracle Certified Associate, Java SE 7 Programmer - Java SE 7 OCA Training Lab
1Z1-804 - Oracle Certified Professional, Java SE 7 Programmer - Java EE 7 OCP Online Training
Published January 8, 2013 Reads 2,283
Copyright © 2013 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Kenrick Freemen
Kenrick Freemen is a software architect doing consulting for banking and education domains. He has more than 6 years of experience in developing Java EE applications. He is a Sun Certified Java Programmer, Oracle Certified Professional, Java EE 5 Web Services Developer and Sun Certified Java EE Architect.
- Cloud People: A Who's Who of Cloud Computing
- New Relic Q1 2013 Blazes Past Growth Targets and Reaches 40,000 Active Customer Accounts
- Cloud Expo New York: Delivering Digital Marketing on the Cloud
- Cloud Expo New York: Rethink IT and Reinvent Business with IBM SmartCloud
- The Accessibility of the Cloud
- Cloud Expo NY: Best Practices for Delivering Oracle Database as a Service
- Cloud Expo New York: Basics of SSD Technology and Its Use in Cloud
- Session Topics: 12th Cloud Expo / Cloud Expo New York
- Cloud Expo New York: The Big Challenge of Big Data & Hadoop Integration
- What CIOs Need to Know About Enterprise Virtualization
- Measuring the Business Value of Cloud Computing
- Cloud Expo New York: Build Modern Business Applications
- Cloud People: A Who's Who of Cloud Computing
- Cloud Expo New York: Best CIO Practices Shared from SHI’s Customers
- Cloud Expo New York: How to Use Google Apps Script
- New Relic Q1 2013 Blazes Past Growth Targets and Reaches 40,000 Active Customer Accounts
- Cloud Expo New York: Why Big Data Is Really About Small Data
- Small Cancers, Big Data, and a Life Examined
- Cloud Expo New York: Delivering Digital Marketing on the Cloud
- Cloud Expo New York: Requirements of a Cloud Database
- Cloud Expo New York: Rethink IT and Reinvent Business with IBM SmartCloud
- Cloudant to Exhibit at Cloud Expo & Big Data Expo New York
- The Accessibility of the Cloud
- Learn How To Use Google Apps Script
- A Cup of AJAX? Nay, Just Regular Java Please
- Java Developer's Journal Exclusive: 2006 "JDJ Editors' Choice" Awards
- JavaServer Faces (JSF) vs Struts
- The i-Technology Right Stuff
- Rich Internet Applications with Adobe Flex 2 and Java
- Java vs C++ "Shootout" Revisited
- Bean-Managed Persistence Using a Proxy List
- Reporting Made Easy with JasperReports and Hibernate
- Creating a Pet Store Application with JavaServer Faces, Spring, and Hibernate
- Why Do 'Cool Kids' Choose Ruby or PHP to Build Websites Instead of Java?
- What's New in Eclipse?
- Where Are RIA Technologies Headed in 2008?
























