- Java Programming Basics
- Java Tutorial
- Java Overview
- Java Environment Setup
- Java Program Structure
- Java Basic Syntax
- Java First Program
- Java Constants
- Java Separators
- Java Keywords
- Java Data Types
- Java Data Types
- Java Integers
- Java Floating Point
- Java Characters
- Java Booleans
- Java Numbers
- Java Programming Variables
- Java Variables
- Java Variable Types
- Java Variable Scope
- Java Type Conversion
- Java Type Casting
- Java Auto Type Promotion
- Java Type Promotion Rules
- Java Programming Arrays
- Java Arrays
- Java One Dimensional Array
- Java Multidimensional Array
- Java Programming Operators
- Java Operators
- Java Arithmetic Operators
- Java Increment Decrement
- Java Bitwise Operators
- Java Left Shift
- Java Right Shift
- Java Relational Operators
- Java Boolean Logical Operators
- Java Ternary(?) Operator
- Java Operator Precedence
- Java Control Statements
- Java Decision Making
- Java if if-else if-else-if
- Java switch Statement
- Java Loops
- Java while Loop
- Java do-while Loop
- Java for Loop
- Java for-each Loop
- Java Nested Loops
- Java break Statement
- Java continue Statement
- Java Class Object Method
- Java Classes and Objects
- Java Class
- Java Object
- Java new Operator
- Java Methods
- Java Constructors
- Java this Keyword
- Java Stack
- Java Overloading Recursion
- Java Method Overloading
- Java Constructor Overloading
- Java Object as Parameter
- Java Call by Value Reference
- Java Returning Objects
- Java Recursion
- Java Modifier Types
- Java Encapsulate Poly String
- Java Encapsulation
- Java Polymorphism
- Java Nested Inner Class
- Java Strings
- Java Command Line Arguments
- Java Variable Length Arguments
- Java Inheritance Abstraction
- Java Inheritance
- Java super Superclass
- Java Multilevel Hierarchy
- Java Method Overriding
- Java Abstraction
- Java Packages Interfaces
- Java Packages
- Java Access Protection
- Java Import Statement
- Java Interfaces
- Java Programming Exceptions
- Java Exception Handling
- Java try catch
- Java throw throws
- Java finally Block
- Java Built In Exceptions
- Java Exception Subclasses
- Java Chained Exceptions
- Java Multithreading
- Java Multithreading
- Java Thread Model
- Java Main Thread
- Java Create Thread
- Java Thread Priorities
- Java Synchronization
- Java Inter Thread Communication
- Java Suspend Resume Stop Thread
- Java Get Thread State
- Java Enum Autobox Annotation
- Java Enumerations
- Java Type Wrappers
- Java Autoboxing
- Java Annotation
- Java Marker Annotations
- Java Single Member Annotation
- Java Built In Annotations
- Java Type Annotations
- Java Repeating Annotations
- Java Data File Handling
- Java Files I/O
- Java Streams
- Java Read Console Input
- Java Write Console Output
- Java PrintWriter Class
- Java Read Write Files
- Java Automatically Close File
- Java Programming Advance
- Java Date and Time
- Java Regular Expressions
- Java Collections Framework
- Java Generics
- Java Data Structures
- Java Network Programming
- Java Serialization
- Java Send Email
- Java Applet Basics
- Java Documentation
- Java Programming Examples
- Java Programming Examples
Java 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.
Java is a powerful object-oriented programming language.
Java is very similar to C++ but it is specially used for web page designing. The Java programming language is a general purpose language, like C and C++, any kind of problem can be solved in this language.
The byte code interpreter program is used to run the Java program. This program is also called the Java Virtual Machine (JVM). The bytecode interpreter is not dependent on any specific computer. It can be used on any computer.
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
Java is developed in 1991 by sun microsystems.
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 :
- To adapt to changing the environments and uses
- To implement improvements and refinements in the art of programming
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:
- Simple
- Secure
- Portable
- Object-oriented
- Robust
- Multithreaded
- Architecture-neutral
- Interpreted
- High performance
- Distributed
- Dynamic
Following is a simple Java program :
import java.util.Scanner; public class fresherearth { public static void main(String[] input) { System.out.println("Java Tutorial at jobails.com"); } }
The sample output produced by above program, is shown in the snapshot given below:
Following is one more Java programming example :
import java.util.Scanner; public class fresherearth { public static void main(String[] input) { String name; Scanner scan = new Scanner(System.in); System.out.print("Enter Your Name: "); name = scan.nextLine(); System.out.println("\nHey,\n" +name+ "!\nAre you ready?"); } }
The snapshot given below shows the sample run of above Java code, with user input Albert:
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.
Audience
This tutorial is designed and developed to help all those Java programmers, who are interested to practice a lot of programs in Java along with its description.
In this tutorial series, we have included as many program as required in each and every chapter.
Prerequisites
Before start learning Java, you must have some basic computer knowledge.
And if you have some basic knowledge in how to program in C or C++, then it becomes very easy to learn Java here.
« fresherearth Home Next Tutorial »