- 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 Classes and Objects
The class is at the core of Java. It is the logical concept upon which the entire Java language is built because it defines the shape and the nature of an object. As such, the class forms the basic for object-oriented programming in Java.
A class creates a new data type that can be used to create objects i.e., a class creates a logical framework which defines the relationship between its members. When you declare an object of a class, you are creating an instance of that class. Therefore, a class is a logical construct. An object has physical reality i.e., an object occupies space in memory.
Any concept you wish to implement in a Java program must be encapsulated within a class.
Classes in Java
A class in Java, can be defined as a template or blue print, describes the states or behaviours, that the objects or its type support. You will learn more about classes in separate chapter.
Objects in Java
Objects in Java, have states and behaviours. An object in Java, is an instance of a class. You will learn more about objects in separate chapter.
Constructors
Every class in Java, has a constructor. If we do not explicitly write a constructor for a class, then the Java compiler builds the default constructor for the same class. You will learn more about constructors in separate chapter.
Create an Object
Since a class in Java, provides the blueprints for objects. Therefore an object is created from a class. You will learn more about creating objects in separate chapter.
Java Package
Package in Java, is a way of categorizing the classes and interfaces. When developing the Java applications, approximately about hundreds of classes and interfaces will be written, therefore categorizing these classes is must to make your program or software much easier. You will learn more about packages in separate chapter.
Import statements
Import statement in Java, is simply a way of giving the proper location for the compiler to find that particular class. You will learn more about importing packages in separate chapter.
« Previous Tutorial Next Tutorial »