• Skip to main content
  • Skip to primary sidebar
  • Skip to secondary sidebar
  • Skip to footer

Computer Notes

Library
    • Computer Fundamental
    • Computer Memory
    • DBMS Tutorial
    • Operating System
    • Computer Networking
    • C Programming
    • C++ Programming
    • Java Programming
    • C# Programming
    • SQL Tutorial
    • Management Tutorial
    • Computer Graphics
    • Compiler Design
    • Style Sheet
    • JavaScript Tutorial
    • Html Tutorial
    • Wordpress Tutorial
    • Python Tutorial
    • PHP Tutorial
    • JSP Tutorial
    • AngularJS Tutorial
    • Data Structures
    • E Commerce Tutorial
    • Visual Basic
    • Structs2 Tutorial
    • Digital Electronics
    • Internet Terms
    • Servlet Tutorial
    • Software Engineering
    • Interviews Questions
    • Basic Terms
    • Troubleshooting
Menu

Header Right

Home » Java » Java Introduction

Serialization and Deserialization in Java with Example

By Dinesh Thakur

The objects in our programs exist only while the program is executing. When the program closed, these objects cease to exist. How can we save an object in our program and restore it when the program rerun? For example, suppose that we are playing a computer chess game. We close the game before it finished. When we restart the game, it should resume from where we had left it, instead of from the beginning. One way to accomplish this would be to save information about the game (such as the locations of various game pieces, scores, and so forth) to a file, and then read this information back from the file to restore the game to the state where we had left it when it runs next. This is the idea behind serialization. Serialization is saving an object’s state as a binary stream (that is, as a sequence of bytes). When an object is serialized, it is said to be flattened or deflated. The reverse process of constructing an object from the binary data is known as deserialization. Thus, a deserialised (or inflated) object is one whose state has restored. [Read more…] about Serialization and Deserialization in Java with Example

Scanner Class in Java With Example

By Dinesh Thakur

In Java 1.5, a new class known as Scanner class was introduced to simplify the task of getting input from the user. The Scanner class is in java.util package which allows the user to read the data dynamically from the keyboard. It can be used to read a File on the disk. The Java Scanner class extends Object class is present in java.lang package and implements Iterator and Closeable interfaces. [Read more…] about Scanner Class in Java With Example

What is an Immutable Class in Java? How to create it.

By Dinesh Thakur

Immutable class means unmodifiable or unchangeable, i.e., once the object has been created, they are immutable objects, there is no way to modify the text it represents. In Java, all primitive java.lang package wrapper classes (like String, Boolean, Byte, Short, Integer, Long, Float, Double, etc.) and String classes are immutable. [Read more…] about What is an Immutable Class in Java? How to create it.

How to Implementing linked lists in java

By Dinesh Thakur

In this section, we will see the implementation of a simplified version of linked list class provided by the Java library. This shows how the lists of operations manipulate the links when the list is modified. [Read more…] about How to Implementing linked lists in java

What is programming?

By Dinesh Thakur

You’ve probably used a computer for work or leisure. Many people use computers for everyday tasks such as check the bank balance or write a school report. Computers are good for these tasks. They can treat repetitive tasks, such as adding numbers or insert words on a page without getting bored or exhausted. Computers are also good for games because they can play sequences of sounds and images, involving the human user in the process. [Read more…] about What is programming?

What is RMI Architecture?

By Dinesh Thakur

The RMI architecture, shown in Figure, describes how remote objects behave and how parameters are passed between remote methods. Remote method invocation allows the program to define separately the behaviour and the code that implements the behaviour and allows running them on separate JVMs. This principle facilitates the clients to focus on the definition of a service while the servers can focus on providing the service. [Read more…] about What is RMI Architecture?

What is RMI (Remote Method Invocation)?

By Dinesh Thakur

The Java RMI comes along with Java JDK l.l and higher versions. It is a true distributed computing application interface for Java. Java RMI is language-specific, and can provide more advanced features like serialization, security and so on. [Read more…] about What is RMI (Remote Method Invocation)?

Example of this Pointer in Java

By Dinesh Thakur

[Read more…] about Example of this Pointer in Java

Demonstration of this Pointer

By Dinesh Thakur

[Read more…] about Demonstration of this Pointer

What is applet?

By Dinesh Thakur

Applet: A small program for specific functions, which usually come with the operating system. Examples in Windows are Paint and Notepad. On a Macintosh, examples are Calculator and Scrapbook. The name comes from the term “applications” which is one variety of a software program. [Read more…] about What is applet?

Java Input Program Example

By Dinesh Thakur

We will now make a small program that will input two integers in Java and display their sum. In this program, we will use the methods available in Scanner class to read data typed at keyboard and place it into variables that we specify. [Read more…] about Java Input Program Example

Hello World Java Example

By Dinesh Thakur

All Java programs usually start as text files that later use to create “class” files, which are executable programs. It means that Java programs can be written in any simple text editor such as Notepad. [Read more…] about Hello World Java Example

Java Class Example Code

By Dinesh Thakur

A Java class is a group of Java objects all of which have the same or similar properties in common. Classes are logical entities and can never be physical. In a class  you may find:
● Fields
● Methods
● Constructors
● Blocks
● Nested classes and an interface
[Read more…] about Java Class Example Code

Write a java program to calculate the simple and compound interest using Scanner class.

By Dinesh Thakur

In this Example we Reading amount, Year and interest in the class Scanner becomes analogous to reading string. In this example, the three numbers are read from the console, and then perform Simple Interest,Compound Interest operations and results printed on the screen in formatted output. [Read more…] about Write a java program to calculate the simple and compound interest using Scanner class.

Write a java program to get the input through the keyboard using scanner class.

By Dinesh Thakur

In this Example we Reading the numbers and string in the class Scanner becomes analogous to reading string. In this example, the two numbers are read from the console, results printed on the screen formatted output. [Read more…] about Write a java program to get the input through the keyboard using scanner class.

Types of Java Program

By Dinesh Thakur

Java program has two types. They are: [Read more…] about Types of Java Program

How to compiling and running a Java program

By Dinesh Thakur

The first step of compiling and running a Java program is to write the text of your program in a document and save it on the hard drive. This document is called a source file, and you must name it with a .java extension. Next, compile this program using a Java compiler. The compiler checks the program for errors and, if no errors are found, it generates a new document containing Java bytecode. This document is called a class file, and its name ends with a .class extension. [Read more…] about How to compiling and running a Java program

Difference between Procedural and Object Oriented Programming

By Dinesh Thakur

The different languages reflect the different styles of programming. OOP or object-oriented programming is a style of programming with a firm basis in several concepts. Those concepts revolve around objects and classes and include Polymorphism, Encapsulation, Inheritance, Abstraction and more.  Java is one of the most popular of all the object-oriented programming languages, as well as one of the easiest to learn and use.   
Any application built on objects in Java is an object-oriented application and is based on the declaration of one or more classes, with an object created from those classes and the interaction between the objects.     [Read more…] about Difference between Procedural and Object Oriented Programming

Access Modifiers In Java

By Dinesh Thakur

Modifiers are keywords used to define the scope and behaviour of classes, methods and variables in Java. Access modifiers specified who can access them. Java has a wide variety of modifiers that can be categorized as shown below: [Read more…] about Access Modifiers In Java

Java this keyword with example

By Dinesh Thakur

The this keyword in Java is used when a method has to refer to an object that has invoked it. It can be used inside any method to refer to the current object. This means that this is always used as a reference to the object on which the method was invoked. We can use this anywhere as reference to an object of the current class type is permitted. [Read more…] about Java this keyword with example

Garbage Collection in Java

By Dinesh Thakur

When you create an object by instantiating a class, the object uses some memory. After an object in memory has been used and is no longer needed, it is sensible to free memory from that object. Unlike some object-oriented languages where you have to explicitly destroy the objects that are no more references to that object. References that held in a variable naturally dropped when the variable goes out of scope. Alternatively, we can explicitly drop an object reference by setting the variable to null. which is a tedious and error-prone task, Java follows a different approach. [Read more…] about Garbage Collection in Java

Interface in java with Example Programs

By Dinesh Thakur

Java interface use for achieving 100% abstraction because the interface only contains methods without any implementation or body. However, it has only abstract methods and constants (final fields). Any field declared inside the interface is public, static, and final by default, and any method is an abstract public method. It specifies what must do but not how. Once an interface is defined, the class implements an interface by implementing each method declared by the interface. Also, one class can implement any number of interfaces. [Read more…] about Interface in java with Example Programs

Java Classes and Objects (With Example) – Definition

By Dinesh Thakur

Objects and classes are the essential concepts in OOP as they are what we use for writing our programs. Java objects may be both physical and logical entities, but classes are only logical entities. [Read more…] about Java Classes and Objects (With Example) – Definition

Inheritance in Java

By Dinesh Thakur

The objects are the building blocks of the object oriented programming language. A programmer may use multiple objects belonging to different classes in some situations, which may have some relationship among themselves as they share some common features. 

Let us consider an example of a program containing objects of two different classes, Car and Motorcycle, for maintaining car and motorcycle information, respectively. Both Car and Motorcycle classes exhibit some relationship as both are vehicles and share some common features like speed, engine specification, etc. To represent the relationship between classes, we use the concept of Inheritance. [Read more…] about Inheritance in Java

What is Polymorphism in java? With Example

By Dinesh Thakur

Polymorphism is a very powerful concept that allows you to design amazingly flexible applications. The word ‘Polymorphism: is derived form two Greek words ‘poly‘ which means many and ‘morphos‘ which means forms. So, polymorphism means the ability to take many forms. [Read more…] about What is Polymorphism in java? With Example

What is Encapsulation in Java? – Definition

By Dinesh Thakur

Definition: Encapsulation and data hiding are the key features of object oriented programming. Encapsulation refers to the ability to package related behavior in an object bundle and control or restrict their access in both function and data from other objects. It necessarily is all about packaging related stuff together and keeping them away from external elements. You will note that keywords encapsulation along with data hiding is used interchangeably all over. [Read more…] about What is Encapsulation in Java? – Definition

What is Constructor in Java with Example

By Dinesh Thakur

Initializing a variable is considered very helpful while making programs. We can initialize variables of primitive types at the time of their declarations. For example: [Read more…] about What is Constructor in Java with Example

What is Java? – Definition and Meaning

By Dinesh Thakur

Java is the object-oriented, platform-independent programming language used to develop distributed applications that run on the Internet. It is similar to C++ high-level programming language and architecture-neutral developed by James Gosling, an engineer at Sun Microsystems in 1995 and later acquired by Oracle Corporation. He decided to create a new language since he was not very happy with the C++ programming language used and first named it Oak  after the oak tree that he could observe from his office window. [Read more…] about What is Java? – Definition and Meaning

Java Compiler

By Dinesh Thakur

The Java Compiler (Javac) is a command line tool that reads java source code files and compiles them into executable Java bytecode classes. The Java source code must be contained in files whose file names end with .java extension. [Read more…] about Java Compiler

What is enum in java?

By Dinesh Thakur

Enumeration (enum) was not originally available in Java though it was available in other language like C and C++ but eventually Java realized and added to version 5 of Java were the safe type enumerations (Type Safe Enums), which allows you to create enums in Java, just as they exist in other technologies. It is defined by the reserved word enum, and each item in the enumeration is represented by an object of the same type as the Enum. The definition of an enumeration is no more than the definition of a special kind of class. If they were in another package, they should be imported like any other normal classes. [Read more…] about What is enum in java?

Primary Sidebar

Java Tutorials

Java Tutorials

  • Java - Home
  • Java - IDE
  • Java - Features
  • Java - History
  • Java - this Keyword
  • Java - Tokens
  • Java - Jump Statements
  • Java - Control Statements
  • Java - Literals
  • Java - Data Types
  • Java - Type Casting
  • Java - Constant
  • Java - Differences
  • Java - Keyword
  • Java - Static Keyword
  • Java - Variable Scope
  • Java - Identifiers
  • Java - Nested For Loop
  • Java - Vector
  • Java - Type Conversion Vs Casting
  • Java - Access Protection
  • Java - Implicit Type Conversion
  • Java - Type Casting
  • Java - Call by Value Vs Reference
  • Java - Collections
  • Java - Garbage Collection
  • Java - Scanner Class
  • Java - this Keyword
  • Java - Final Keyword
  • Java - Access Modifiers
  • Java - Design Patterns in Java

OOPS Concepts

  • Java - OOPS Concepts
  • Java - Characteristics of OOP
  • Java - OOPS Benefits
  • Java - Procedural Vs OOP's
  • Java - Polymorphism
  • Java - Encapsulation
  • Java - Multithreading
  • Java - Serialization

Java Operator & Types

  • Java - Operator
  • Java - Logical Operators
  • Java - Conditional Operator
  • Java - Assignment Operator
  • Java - Shift Operators
  • Java - Bitwise Complement Operator

Java Constructor & Types

  • Java - Constructor
  • Java - Copy Constructor
  • Java - String Constructors
  • Java - Parameterized Constructor

Java Array

  • Java - Array
  • Java - Accessing Array Elements
  • Java - ArrayList
  • Java - Passing Arrays to Methods
  • Java - Wrapper Class
  • Java - Singleton Class
  • Java - Access Specifiers
  • Java - Substring

Java Inheritance & Interfaces

  • Java - Inheritance
  • Java - Multilevel Inheritance
  • Java - Single Inheritance
  • Java - Abstract Class
  • Java - Abstraction
  • Java - Interfaces
  • Java - Extending Interfaces
  • Java - Method Overriding
  • Java - Method Overloading
  • Java - Super Keyword
  • Java - Multiple Inheritance

Exception Handling Tutorials

  • Java - Exception Handling
  • Java - Exception-Handling Advantages
  • Java - Final, Finally and Finalize

Data Structures

  • Java - Data Structures
  • Java - Bubble Sort

Advance Java

  • Java - Applet Life Cycle
  • Java - Applet Explaination
  • Java - Thread Model
  • Java - RMI Architecture
  • Java - Applet
  • Java - Swing Features
  • Java - Choice and list Control
  • Java - JFrame with Multiple JPanels
  • Java - Java Adapter Classes
  • Java - AWT Vs Swing
  • Java - Checkbox
  • Java - Byte Stream Classes
  • Java - Character Stream Classes
  • Java - Change Color of Applet
  • Java - Passing Parameters
  • Java - Html Applet Tag
  • Java - JComboBox
  • Java - CardLayout
  • Java - Keyboard Events
  • Java - Applet Run From CLI
  • Java - Applet Update Method
  • Java - Applet Display Methods
  • Java - Event Handling
  • Java - Scrollbar
  • Java - JFrame ContentPane Layout
  • Java - Class Rectangle
  • Java - Event Handling Model

Java programs

  • Java - Armstrong Number
  • Java - Program Structure
  • Java - Java Programs Types
  • Java - Font Class
  • Java - repaint()
  • Java - Thread Priority
  • Java - 1D Array
  • Java - 3x3 Matrix
  • Java - drawline()
  • Java - Prime Number Program
  • Java - Copy Data
  • Java - Calculate Area of Rectangle
  • Java - Strong Number Program
  • Java - Swap Elements of an Array
  • Java - Parameterized Constructor
  • Java - ActionListener
  • Java - Print Number
  • Java - Find Average Program
  • Java - Simple and Compound Interest
  • Java - Area of Rectangle
  • Java - Default Constructor Program
  • Java - Single Inheritance Program
  • Java - Array of Objects
  • Java - Passing 2D Array
  • Java - Compute the Bill
  • Java - BufferedReader Example
  • Java - Sum of First N Number
  • Java - Check Number
  • Java - Sum of Two 3x3 Matrices
  • Java - Calculate Circumference
  • Java - Perfect Number Program
  • Java - Factorial Program
  • Java - Reverse a String

Other Links

  • Java - PDF Version

Footer

Basic Course

  • Computer Fundamental
  • Computer Networking
  • Operating System
  • Database System
  • Computer Graphics
  • Management System
  • Software Engineering
  • Digital Electronics
  • Electronic Commerce
  • Compiler Design
  • Troubleshooting

Programming

  • Java Programming
  • Structured Query (SQL)
  • C Programming
  • C++ Programming
  • Visual Basic
  • Data Structures
  • Struts 2
  • Java Servlet
  • C# Programming
  • Basic Terms
  • Interviews

World Wide Web

  • Internet
  • Java Script
  • HTML Language
  • Cascading Style Sheet
  • Java Server Pages
  • Wordpress
  • PHP
  • Python Tutorial
  • AngularJS
  • Troubleshooting

 About Us |  Contact Us |  FAQ

Dinesh Thakur is a Technology Columinist and founder of Computer Notes.

Copyright © 2025. All Rights Reserved.

APPLY FOR ONLINE JOB IN BIGGEST CRYPTO COMPANIES
APPLY NOW