codescracker


java

Java Tutorial



« CodesCracker Home Next Tutorial »


This tutorial will teach you all about Java programming from very basic for beginner to advance.

What is Java ?

Java is one of the world's most important, widely used computer programming language.

Unlike some other computer programming languages whose influence (shape) has waned (declined) with the passage of time, Java's has grown stronger.

Today, Java is still the first and best choice in developing web-based applications.

Why Java?

A key reason for Java's success is its agility. Since its original 1.0 release, Java has continually adapted to changes in the programming environment and to changes in the way that programmers program. Most importantly, it has not just followed the trends, it has helped create them. Java's ability to accommodate the fast rate of change in the computing world is a crucial part of why it has been and continues to be so successful.

History of Java

To fully understand Java, one must understand the reason behind its creation, the forces that shaped it, and the legacy that it inherits. Like successful computer languages that came before, Java is a blend of the best elements of its deep heritage combined with innovative concepts, required by its unique mission.

Although Java has become inseparably linked with online environment of the Internet.

Computer language and developments occurs for two fundamental reasons :

How Java Changed the Internet?

The Internet helped launcher Java to the head of programming, and Java, in turn, had a profound effect on the Internet. In addition to simplifying web programming, Java innovated a new type of networked program called the applet that changed the way that the online world thought about content. Java also addressed some of the thorniest issues associated with the Internet: portability and security.

Java Applets

An applet is a special form of Java program that is designed to be transmitted over the Internet and automatically executed by a Java-compatible web browser.

Security

As you are probably aware, every time you download a "normal" program, you are taking a risk (danger), because(as) the code you are going to download might contain a virus. Trojan horse, or other harmful code. At the core of the problem is fact that the malicious code can cause its damage because it has gained unauthorized access to system resources.

Java achieved this protection by confining (limiting) an applet to the Java execution environment and not allowing it access to the other parts of the computer.

Portability

Portability is a major aspect of Internet because there are many dissimilar types of computers and operating systems, connected to it. If any Java program were to be run on virtually any computer connected to Internet, there needed to be some way to enable that program to execute on different system.

Java's Magic: The Bytecode

The main key, allows Java to solve, security and portability, both the problems, just described is that the output of Java compiler is not executable code, instead, it is bytecode, which is highly optimized set of instructions that is designed to be executed on the Java runtime system, called as Java Virtual Machine (JVM).

Servlets: Java on the Server Side

As useful as the applets can be, they are just one half of client/server equation. Not long after the initial release of Java, it became evident that Java would also be useful on server side. The result was the servlet. A servlet is a small program that executes on the server. Just an Applets dynamically extend the functionality of a Web browser; Servlets dynamically extend the functionality of a Web server. So, with coming of the servlet, Java spanned both sides of the client/server connection.

The Java Buzzwords

No discussion of the Java's history can complete without a look at the Java buzzwords.Security and portability are the fundamental forces that neccessitated (demanded) the invention of Java, other factors are also played an important role in molding the final form of the language. The key consideration were summed up by the Java team in the following list of buzzwords:

A Simple Java Program

Following is a simple Java program :

/* Java Tutorial - Learn Java Programming - Java Programming Tutorial */
	
public class JavaProgram
{
    public static void main(String args[])
    {
        
        System.out.print("Java Tutorial at codescracker.com");
        
    }
}

When the above Java Program is compile and executed, it will produce the following output:

java tutorial

Following is one more Java programming example :

/* Java Tutorial - Java Programming Tutorial - Learn Java Programming */

import java.util.Scanner;

public class JavaProgram
{
    public static void main(String args[])
    {
        
        String name;
        Scanner scan = new Scanner(System.in);
        
        System.out.print("Enter Your Name :");
        name = scan.nextLine();
        
        System.out.println("Hello " +name+ " Sir!, You are learning Java at codescracker.com");
        
    }
}

When the above Java program is compile and executed, it will produce the following output:

learn java

Note - Don't be confuse from the above Java program, this is just an example, you will learn all the concepts of Java programming in separate chapters later.

You will learn all about Java in this tutorial series. This Java tutorial series is divided into the following parts:

Java Programming Basics Tutorial
Homepage of Java Tutorial Overview of Java Programming
Environment Setup for Java Structure of Java Program
Basic Syntax of Java Program Simplest Program in Java
Constants in Java Separators in Java
Keywords in Java
Java Programming Data Types and Numbers Tutorial
Data Types in Java Integers in Java
Floating Point Types in Java Characters in Java
Booleans in Java Numbers in Java
Java Programming Variables Tutorial
Variables in Java Variable Types in Java
Variable Scope in Java Type Conversion in Java
Type Casting in Java Automatic Type Promotion in Java
Type Promotion Rules in Java
Java Programming Arrays Tutorial
Arrays in Java One Dimensional Arrays in Java
Multidimensional Arrays in Java
Java Programming Operators Tutorial
Operators in Java Arithmetic Operators in Java
Increment Decrement in Java Bitwise Operators in Java
Left Shift in Java Right Shift in Java
Relational Operators in Java Boolean Logical Operators in Java
Ternary(?) Operator in Java Operator Precedence in Java
Java Programming Control Statements and Loops Tutorial
Decision Making in Java if if-else Statement in Java
switch Statement in Java Loops in Java
for Loop in Java for-each Loop in Java
while Loop in Java do-while Loop in Java
Nested Loops in Java break Statement in Java
continue Statement in Java
Java Programming Classes, Objects, Methods, Constructors and Stack Tutorial
Classes and Objects in Java Class in Java
Object in Java new Operator in Java
Methods in Java Constructors in Java
this Keyword in Java Stack in Java
Java Programming Methods Overloading, Constructors Overloading Tutorial
Methods Overloading in Java Constructors Overloading in Java
Objects as Parameters in Java Argument Passing in Java
Returning Objects in Java Recursion in Java
Modifier Types in Java
Java Programming Encapsulation, Polymorphism and Strings Tutorial
Encapsulation in Java Polymorphism in Java
Nested Inner Classes in Java Strings in Java
Java Programming Command Line and Variable Length Arguments Tutorial
Command Line Arguments in Java Variable Length Arguments in Java
Java Programming Inheritance, Method Overriding and Abstraction Tutorial
Inheritance in Java super Superclass in Java
Multilevel Hierarchy in Java Method Overriding in Java
Abstraction in Java
Java Programming Packages and Interfaces Tutorial
Packages in Java Access Protection in Java
Importing Statement in Java Interfaces in Java
Java Programming Exception Handling Tutorial
Exception Handling in Java try catch in Java
throw throws in Java finally Keyword in Java
Built In Exceptions in Java Exception Subclasses in Java
Chained Exceptions in Java
Java Programming Multithreading Tutorial
Multithreading in Java Thread Model in Java
Main Thread in Java Create Thread in Java
Thread Priorities in Java Synchronization in Java
Inter Thread Communication in Java Suspend Resume Stop Thread in Java
Get Thread State in Java
Java Programming Enum, Autobox and Annotation Tutorial
Enumerations in Java Type Wrappers in Java
Autoboxing in Java Annotation in Java
Marker Annotations in Java Single Member Annotations in Java
Built In Annotations in Java Type Annotations in Java
Repeating Annotations in Java
Java Programming File Handling Tutorial
Files I/O in Java Streams in Java
Read Console Input in Java Write Console Output in Java
PrintWriter Class in Java Read Write Files in Java
Automatically Close File in Java
Java Programming Advance Tutorial
Date and Time in Java Regular Expressions in Java
Collections Framework in Java Generics in Java
Data Structures in Java Network Programming in Java
Serialization in Java Send Email in Java
Applet Basics in Java Documentation in Java
Java Programming Examples
Homepage of Java Programming Examples Print Hello World in Java
Get Input from User in Java Print Integer in Java
Add two Numbers in Java Check Even or Odd in Java
Check Prime or Not in Java Check Alphabet or Not in Java
Check Vowel or Not in Java Check Leap Year or Not in Java
Check Reverse equal Original or Not in Java Add Subtract Multiply Divide in Java
Make Simple Calculator in Java Add Digits of Number in Java
Calculate Average and Percentage Marks in Java Calculate Arithmetic Mean in Java
Calculate Student's Grade in Java Print Table of Number in Java
Print Prime Numbers in Java Add n Numbers in Java
Interchange two Numbers in Java Reverse Numbers in Java
Swap two Numbers in Java Count Positive, Negative and Zero in Java
Find Largest of two Numbers in Java Find Largest of three Numbers in Java
Find Factorial of Number in Java Find HCF and LCM in Java
Calculate Area and Perimeter in Java Calculate Area and Circumference in Java
Convert Fahrenheit to Centigrade in Java Convert Centigrade to Fahrenheit in Java
Print ASCII Values in Java Print Fibonacci Series in Java
Check Palindrome or Not in Java Find Armstrong Number in Java
Generate Armstrong Numbers in Java Find ncR and nPr in Java
Convert Decimal to Binary in Java Convert Decimal to Octal in Java
Convert Decimal to Hexadecimal in Java Convert Binary to Decimal in Java
Convert Binary to Octal in Java Convert Binary to Hexadecimal in Java
Convert Octal to Decimal in Java Convert Octal to Binary in Java
Convert Octal to Hexadecimal in Java Convert Hexadecimal to Decimal in Java
Convert Hexadecimal to Binary in Java Convert Hexadecimal to Octal in Java
Pattern Programs in Java Print Diamond Pattern in Java
Print Floyd's Triangle in Java Print Pascal Triangle in Java
One-Dimensional Array Program in Java Linear Search in Java
Binary Search in Java Add two Numbers using Pointers in Java
Find Largest Element in Array in Java Find Smallest Element in Array in Java
Reverse Array in Java Insert Element in Array in Java
Delete Element from Array in Java Merge two Array in Java
Bubble Sort in Java Selection Sort in Java
Insertion Sort in Java Two-Dimensional Array Program in Java
Add two Matrices in Java Subtract two Matrices in Java
Transpose Matrix in Java Multiply two Matrices in Java
Three-Dimensional Array Program in Java Print String in Java
Find length of String in Java Compare two String in Java
Copy String in Java Concatenate String in Java
Reverse String in Java Delete Vowels from String in Java
Delete Words from Sentence in Java Count Character in String in Java
Count Word in Sentence in Java Remove Spaces from String in Java
Sort a String in Java Convert Uppercase to Lowercase in Java
Convert Lowercase to Uppercase in Java Swap two Strings in Java
Check Anagram or Not in Java Generate Random Numbers in Java
Read File in Java Write to File in Java
Read and Display File's Content in Java Copy File in Java
Merge two File in Java List Files in Directory in Java
Delete File in Java Print Time and Date in Java
Get IP Address in Java Shutdown Computer in Java
Java Programming Interview Questions and Answers
Java Interview Questions

« CodesCracker Home Next Tutorial »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test