• 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

Filter Streams

By Dinesh Thakur

The java.io package provides a set of abstract classes that define and partially implement Filter streams. A Filter stream filters data as it is being read from or written to the stream. The two filter streams for reading and writing data are Filter input Stream and Filter Output Stream ,respectively.

 

A filter stream is constructed on another stream. That is, every filtered stream must be attaché to another stream. This can be achieved by passing an instance of Input Stream or Output Stream to a constructor. This implies that filter streams are chained. Multiple filters can be added by chaining them to a stream of bytes. The read method in a readable filter stream reads input from the underlying stream, filters it and passes on the filtered data to the caller. The write method in a writable filter stream filters the data and then writes it to the underlying stream. The filtering done by the streams depends on the stream. Some streams buffer the data, some count data as they go by and others convert data from the original form to a different one. Most filter streams provided by the java.io package are sub-classes of Filter input Stream and Filter Output Stream, and are listed below:

   • Data input Stream and Data Output Stream

   • Buffered input Stream and Buffered Output Stream

   • Line Number input Stream

   • Push back input Stream

   • Print Stream

The java.io package contains only one sub-class of Filter Reader known as Push back Reader.

To create filter input or output stream, we should attach the filter stream to another input or output stream. For example, we can attach a filter stream to the standard input stream in the following manner:

 BufferedReader d = new BufferedReader(new InputStreamReader(System. in));

                 String input;

                 While((input = d.readLine()) != null)

                {

                    ……

               }

The above code is useful for reading the data from the console. Here, Input Stream Reader is attached to Buffered Reader which acts as the filter stream.

Data input Stream and Data Output Stream

Data input Stream (Data Output Stream) is a filtered input (output) stream and hence must be attached to some other input (output) stream. Data input Stream handles reading in data as well as lines of text. Program stores the data which are read from the console in tabular format using Data Output Stream. After that, the program reads the data using the Data input Stream.

Program Using Data Output Stream and Data input Stream.

import java.io.*;

class Sample Stream

{                      

      public static void main(String a[ ]) throws IOException

     {

            DataOutputStream out = new DataOutputStream(new

                                                       File Output Stream(“file.txt”));

            InputStreamReader isr = new Input Stream Reader(System. in);

            Buffered Reader is = new BufferedReader(isr);

            char sep = System.get Property(“file.separator”).charAt(0);

            for (int i = 0; i < 5; i ++)

           {

                  System.out.print(“Read the item name:”);

                  String item=br.readLine();

                  out.WriteChars(item+separator);

                  out.WriteChar(‘\t’);

                  System.out. print(“Read the quantity:”);

                  int qun=integer.Parselnt(br.readLine());

                  out.writelnt(qun); 

                  out.writeChar(‘\n’);

           }

            out.c1ose();

            DatalnputStream in = new DatalnputStream(new

            FilelnputStream(“file.txt”));

            try

           {

                  char chr;

                  while (in.avaiiable()>0)

                 {

                       StringBuffer item1 = new StringBuffer(20);

                       while ((chr = in.readChar())!= sep)

                       {

                            item1.append( chr);

                        }

                        System.out.print(item1);

                        System.out.print(in.readChar() );

                        System.out.print(in.read Int());                      

                        System.out.print(in.readChar() );

                }

           }

           catch (EOFException e)

          {

           }

                   in.c1ose();

                }

            }

Running Program  gives the following output:

              Read the item name: Mouse

               Read the quantity: 4

               Read the item name: Keyboard

               Read the quantity: 3

               Read the item name: Monitor

               Read the quantity: 2

               Read the item name: Modem

               Read the quantity: 4

               Read the item name: Hub

               Read the quantity: 4

             Mouse 4

              Keyboard 3

             Monitor 2

              Modem 4

              Hub 4

The above example stores the items required and the quantity of the item. Although the data are read or written in binary form, they appear on the console as characters .Data Output Stream is attached to a File Output Stream that is set up to write to a file namedfile.txt. Data Output Stream writes the data in the file.txt file by using specialized write XXX()methods. Here, XXX represents a Java data type. Next, Sample Stream opens a Data input Stream .on the file just written to read the data from it by using Data input Stream’s specialized read XXX()methods. In general, we use null or -1 to indicate the end of the file. Some methods such as read String()and read Char() in the Data input Stream do not identify null or-1 as an end of file marker. Thus, programmer must be careful while writing loops using Data Input stream for reading characters from a file. The available() method of Data input Stream, which returns the number of bytes remaining, can be used to check whether there are any data remaining to read.

Push back input Stream

Pushback is used on input streams to allow a byte to be read from and returned to the stream. Like all filter streams, Push back input stream is also attached to another stream. It is typically used for some specific implementation, for example, to read the first byte of the data from a stream forth purpose of testing the data. For example, it is mostly required in the case of designing parsers, while reading data, to have glance on the next set of input data. Data must be read and if not found appropriate, it should be placed back into the input stream, which may be read again and processed normally. A Push back input Stream object can be created as follows:

Push back input Stream imp = new Push back input Stream(new Input Stream);

In order to satisfy the requirement of pushing back a byte (or bytes) of an array into the input stream, this stream has the special method called the unread () method.

                        void unread( int ch );

                        void unread( bute buf[ ] );

                        void unread( byte buf[ ], int offset, int numchars );

the first form pushes back the lowest-order byte of ch, which is returned as the next byte when another byte is read. The second and the third forms of the method return the byte in a buffer with the difference that the third method pushes back the number of characters (numchars) starting from the offset. Push back Reader also does the same thing on the character stream.

File input Stream and File Output Stream

By Dinesh Thakur

The File class explains only the file system. Java provides two special types of stream called the File input Stream and File Output Stream to read data from and write data into the file. These classes operate on the files in the native file system. File input Stream and File Output Stream are subclasses of Input Stream and Output Stream, respectively. Usually, we use File input Stream(for byte streams) or File Reader (for character streams) for reading from a file and File Output Stream(for byte streams) or File Writer (for character streams) for writing into a file.

 

We can create a file stream by giving the file name as a parameter in the form of a string, File object or File Descriptor object. File Writer and File Output Stream will create a new file by that name if the file does not already exist.

The constructors of these two streams are:

• FileinputStream(String filename);    • File Output Stream(String filename);

• FileinputStream(File file object);       • File Output Stream(File file object);

• FileinputStream(File Descriptor fdesobject);  • File Output Stream(File Descriptor

                                                                              fdes object);

File Descriptor is an object that holds the information about a file.

A File input Stream object can be created in the following manner:

                        File input Stream fin = new File input Stream(string filename);

Alternatively, it can be created with the following set of statements:

                      File = new File(string filename);

                      File input Stream fin = new File input Stream(f);

A File Output Stream object can be created as follows:

                 File Output Stream foot = new File Output Stream(string filename);

Note that in the case of File Output Stream if it is opened on a file that does not already exist then a new file by that name is created.

Program  implementing the class Copy File uses File input Stream and File Output Stream to copy the contents of input File to output File: input File and output File are the command line arguments arg[0] and arg[1].

 Using Copy File, File input Stream and File Output Stream.

import java.io.*;

public class Copy File

{

      public static void main(String[] args) throws IO Exception

     {

            if(args.length<2)

            System.out.println(“\n No sufficient parameters”);

            else

            {

                File input File = new File(args[0]);

                File output File = new File(args[1]);

                FileinputStream in = new FileInputStream(inputFile);

                FileOutputStream out = new FileOutputStream(outputFile);

               int c;

                while ((c= in.read()) != -1)

                out. write(c);

                   in.c1ose();

                   out.c1ose();

             }

       }

}

In Program the file input File is opened using File input Stream and another file output File is opened using File Output Stream. If input File does not exist, the program gives an error because File input Stream cannot work if the file does not exist. On the other hand, if output File does not exist, then a file by that name will be created. The program continues to read characters from File input Stream as long as there are inputs in the input file and writes these characters on to File Output Stream. When all the inputs have been read, the program closes both File input Stream and File Output Stream. Program  can also be written using File Reader and File Writer with the small changes shown below:

                                         File inputFile = new File(args[0]);

                                         FileReader in = new FileReader(input File);

This code creates a File object that represents the named file on the native file system. File is a utility class provided by java.io. Program the Copy File program uses this file object only to construct a File Reader on a file; however, the program could also use the input file to get information about the file, such as its full path name. If we run Program an exact copy of input File (args[0]) will be found in a file named output File (args[1]) in the same directory. It should be remembered that File Reader and File Writer read and write 16-bit characters; however, most native file systems are based on 8-bit bytes. These streams encode the characters as they operate according to the default character-encoding scheme. The default character-encoding scheme can be found by using System. Get Property(“file. Encoding”). To specify an encoding scheme other than the default, we should construct an Output Stream Writer on a File Output Stream and specify the encoding scheme. It is important to note that the File Output Stream object does not support the means to append file. If the file exists already, File Output Stream only overwrites and cannot add content to amend of the file.

File Streams

By Dinesh Thakur

A file can be created using File class.

                          File;

                          f = new File (string filename);

The File class is defined in the package java.io The File class is used to store the path and name of a directory or file. But this class is not useful in retrieving or storing data. The File object can be used to create, rename or delete file or directory it represents. A directory is treated as a file that contains a list of files. Each file (or directory) in Java is an object of the File class. A File object is used to manipulate the information associated with a disk file, such as last modification date and time, directory path and also to navigate through the hierarchies of sub-directories.

  The File class has three constructors that are used to create a file object. They are the following:

  • File(String pathname);                    II pathname could be file or a directory name

  • File(String dirPathname, String filename); II specify directory where the file is created

                                                                         II and file name

  • File(File directory, String filename);         II file object as the directory path

These constructors return the reference to the file object. The File class provides several methods that deal with the files, file system, properties of the file and tests on the files. Some of the important methods that serve these purposes are listed in Table.

                Some methods in the File class and their description.

Name of method

Description

string get Name ()

Returns the name of the file excluding the directory name

string get Path ()

Returns the path of the file.

string get Parent ()

Returns the parent directory of the file

Boolean exists ()

Returns true if the file exists and returns false if the file does not exist.

Boolean can Read ()

Returns true if the file is readable, otherwise returns false

Boolean can Write ()

Returns true if the file is writable, otherwise returns false

Boolean is File ()

Returns true if the object is a file, otherwise returns false.

Boolean is Directory ()

Returns true if the object is a directory, otherwise returns false.

Boolean is Absolute ()

Returns true if the file path is the absolute path, otherwise it returns false, indicating that it is a relative path.

long length ()

Returns the length of the file (in bytes).

long last Modified ()

Returns the date on which the file was last modified

String[] list ()

Returns the list of all files and directories that exist in the current directory

There are other methods also which are useful for handling file operations such as renaming a

the file and deleting a file. The syntax of these two methods is the following:

                           boolean renameTo(File new file name);

                           boolean delete();

The following methods are used to create a directory:

                          boolean mkdir(File newdirectoryname)

                          boolean mkdirs(File newdirectoryname)

The first method creates a directory and returns true if it is successful. If the directory cannot be created, it returns false. In addition to creating a directory, the second method creates all its parent directories. The path of the directly to be created will be passed as a parameter to the mkdirs method. If the program fails to execute the mkdirs() method fully, it may be successful in creating partial directories list from the user specified path. The method mkdirs() returns true if the directory was created with all the necessary parent directories, otherwise it returns false. Directory is the name of an object in the File class with an extra property referred to as ‘list’ which is examined by the List () method. This method returns the string array with all files that exist in the directory. Program illustrates the List () method.

Using the methods List () and is Directory ()

import java.io.*;

class ListOfiles

{

      public static void main(String a[ ])

     {

           String name = arg[0];

           Filefile1= new File(name);

           if ( file1.isDirectory() )

          {

                 string arr[] = file1.list();

                 for (int i = 0; i < arr.length; i++)

               {

                        if(arr[i]. isDirectory())

                             System.out.println(arr[i]+ “is directory”);

                       else

                           System.out.println(arr[i]+”is file”);

                }

          }

     }

}

Program illustrates the is Directory () method, which returns the value true if the in voting file object is a directory and returns the value false if it is a file. This program is run with the command line arguments in which arg [0] specifies the name of the directory. The output of the program consists of a list of all the files and directories in the present directory that is, the directory given as the input.

Java I/O

By Dinesh Thakur

Streams are represented in Java as classes. The java.io package defines a collection of stream classes that support input and output (reading and writing). To use these classes, a program needs to import the java.io package, as shown below. [Read more…] about Java I/O

I/O Streams

By Dinesh Thakur

A flow of data is often referred to as a data stream. A stream is an ordered sequence of bytes that has a SOURCE (input stream) or a DESTINATION (output stream). In simple terms, a stream can be defined as follows.

 

A stream is a logical device that represents the flow of a sequence of characters. Programs can get inputs from a data source by reading a sequence of characters from the input stream. Similarly, programs can produce outputs by writing a sequence of characters on to an output stream. A stream can be associated with a file, an Internet resource (For example, a socket), to a pipe or a memory buffer. Streams can be chained together so that each type of stream adds its own processing to the bytes as they pass through the stream. For the purpose of letting information flow, a program opens a stream on an information source (whether it be a file, memory, a network socket or any other source) and reads the information sequentially and uses it in the program. All streams behave in the same way even though the physical device connected to them may differ. A program can send information to an external destination by opening a stream to a destination and writing the information out sequentially. In previous chapters, we used the following two methods for taking inputs and giving outputs:

                 System.in.read ()

                 System.out.printIn( );

These two form the basic input and output streams, which are managed by the System class; they use the standard input and standard output streams, respectively.

Thread Synchronization in Java

By Dinesh Thakur

When more than one thread has to use a shared resource, Java finds a way of ensuring that only one thread uses the resources at one point of time; this is called synchronization.

In Java, each object is associated with a lock. The term lock refers to the access granted to a particular thread that has entered a synchronized method. Monitor refers to a portion of the code in a program. It contains one specific region (related to data or some resource) that can be occupied by only one thread at a time. This specific region within a monitor is known as critical section. A thread has exclusive lock from the time it enters the critical section to the time it leaves. That is, the data (or resource) is exclusively served for the thread, and any other thread has to wait to access that data (or resource). Some common terminology while using monitors is as follows: entering the critical section is known as acquiring the monitor, working with the critical section (data or resource) is known as owning the monitor and leaving the critical section is known as releasing the monitor. [Read more…] about Thread Synchronization in Java

Thread Life Cycle in Java

By Dinesh Thakur

A thread can undergo some states during its life cycle. It is because in a multithreaded environment when multiple threads are executing only one thread can use the CPU at a time, and all other threads should be in some other states either waiting for their turn for the CPU or waiting for some other condition to be satisfied. [Read more…] about Thread Life Cycle in Java

Creating Threads in Java

By Dinesh Thakur

In Java, threads are objects and can be created in two ways:

1. by extending the class Thread

2. by implementing the interface Runnable

In the first approach, a user-specified thread class is created by extending the class Thread and overriding its run () method. In the second approach, a thread is created by implementing the Runnable interface and overriding its run () method. In both approaches the run () method has to be overridden. Usually, the code that is to be executed by a thread is written in its run () method. The thread terminates when its run () method returns. [Read more…] about Creating Threads in Java

Advantages of the Exception-Handling Mechanism

By Dinesh Thakur

The main advantages of the exception-handling mechanism in object oriented programming over the traditional error-handling mechanisms are the following: [Read more…] about Advantages of the Exception-Handling Mechanism

Redirecting and Rethrowing Exceptions in Java

By Dinesh Thakur

Redirecting exceptions using throws

Recall that the code capable of throwing an exception is kept in the try block and the exceptions are caught in the catch block. When there is no appropriate catch block to handle the (checked) exception that was thrown by an object, the compiler does not compile the program. To overcome this, Java allows the programmer to redirect exceptions that have been raised up the call stack, by using the keyword throws. Thus, an exception thrown by a method can be handled either in the method itself or passed to a different method in the call stack. [Read more…] about Redirecting and Rethrowing Exceptions in Java

Exception and Inheritance in Java

By Dinesh Thakur

An exception handler designed to handle a specific type of object may be preempted by another handler whose exception type is a super-class of that exception object. This happens if the exception handler for that exception type appears earlier in the list of exception handlers. That is, while using multiple catch statements, it is important to be aware of the order of exception classes and arrange them correctly. [Read more…] about Exception and Inheritance in Java

Unchecked and Checked Exceptions

By Dinesh Thakur

Based on the severity of the error, Exception classes are categorized into two groups: unchecked exceptions and checked exceptions. Unchecked exceptions are those that can be either handled or ignored. If the programmer ignores an unchecked exception, the program will terminate when such an error occurs. On the other hand, if a handler is provided for an unchecked exception, the result of the occurrence of such an error will depend on the code written in the exception handler. An example of an unchecked exception is the class RuntimeException (and its sub-classes), which is a sub-class of the class Exception. It is a very important class in Java programming. [Read more…] about Unchecked and Checked Exceptions

Constructors and Methods in Throwable Class

By Dinesh Thakur

Constructors

There are four constructors in the Throwable class:

• Throwable ()

• Throwable (String message) [Read more…] about Constructors and Methods in Throwable Class

Exception Hierarchy in Java

By Dinesh Thakur

When a condition causes an exception to be thrown, that exception is thrown either by the Java virtual machine or by the Java throw statement. Exceptions are represented by objects instantiated from the class java.lang. Throwable or one of its sub-classes. Java also allows users to define classes that can throw their own (user-defined) exception objects as needed in their design; however, this new class must extend the throwable class or one of its sub-classes. [Read more…] about Exception Hierarchy in Java

Class variables and methods in Java

By Dinesh Thakur

To create a class variable or method, include the word static in front of the method’s name. The modifier static typically comes after any protection modifiers. Given below is an example that illustrates how a class variable may be created in a program. [Read more…] about Class variables and methods in Java

accessor methods in Java

By Dinesh Thakur

Accessor methods are used for initializing and accessing the value of instance variables. The value of these instance variables can be used further in the program. For creating accessor methods, it is required to create two methods among which one method is used to initialize the value and other is used to retrieve the value. An accessor method makes the program more readable and understandable. Moreover, accessor methods are similar to any other method, as can be seen from Program.

Implementing accessor methods.

// A program to find area of a square.

 

import java.io.*;

class AccessorMethodClass

{

         int side;

         //This method is used for initializing the value of global variable ‘side’

         public void setSideValue(int a)

        {

                 side = a;

        }

// This method is used for getting the value of the global value

     public int getSideValue()

     {

               return side:

      }

      public static void main(String args[ ])

     {

                       int area, side;

                     accessorMethodClass ob=new accessorMethodClass();

                     ob.setSideValue(10); // Initializing the value of global variable

                     side = ob.getSideValue(}; // Retrieving the value of Global variable

                     area = side * side; // Finding the area of square.

                     System.out.println(“The area of Square is” +area);

     }

}

The output of Program is as shown below:

The area of Square is 100

In Program the global variable side is initialized by the method setSideValue(int a) and its value is retrieved by the method getSideValue(). Here, the words like set and get make the functionality of accessor methods more clear even though it is not a part of any rules or specifications.

Accessor methods can also have names similar to their instance variable and Java performs the appropriate operation based on the use of these methods and variables, as shown in Program.

Using accessor methods II.

 

// A program to find the area of a square which is equal to square of the side.

import java.io.*;

class AccessorMethodClass

{

       int side;

      // Note that method name and variable name is same

      public void side(int a)

      {

             side = a;

      }

      public int getSideValue()

      {

                    return side;

       }

        public static void main(String args[])

       {

            int area, sidevalue;

               AccessorMethodClass ob = new AccessorMethodClass();

               ob.side(10);

               sidevalue = ob.getSideValue{);

            area = sidevalue*sidevalue;

               System.out.println(“The area of Square is”+area);

         }

}

The output of Program is as shown below:

The area of Square is 100

There are some problems with the convention used for having same name as described in the above program.

• Using same name for the instance variable and method may make the program less readable and understandable. Providing meaningful names to the variables and methods with respect to their functionality is a good programming practice.

• Adopting this type of convention violates the essentials of structured programming.

The four Ps of protection in java

By Dinesh Thakur

Java provides four levels of protection for methods and instance variables: public, private, protected and package. Before applying protection levels to a program, one should know what each form means and understand the fundamental relationships that a method or variable within a class can have to the other classes in the system. [Read more…] about The four Ps of protection in java

Finalizer methods in Java

By Dinesh Thakur

Finalizer methods are almost the opposite of constructor methods. A constructor method is used to initialize an object, while finalizer methods are called just before the object is garbage-collected and its memory reclaimed. The syntax of the finalizer method is simply finalize(). The Object class defines a default finalizer method. To create a finalizer method, override the finalize() method using the following signature: [Read more…] about Finalizer methods in Java

Overriding Constructors in Java

By Dinesh Thakur

Super-class constructors cannot be overridden as the constructors have the same name as their class. To be able to access a constructor in a sub-class with the same number and data type of arguments as in the super-class, it must be defined in the sub-class itself. When constructors are defined in a sub-class, the corresponding super-class constructors are called during the creation of objects of that sub-class. This ensures that the initialization of inherited parts of the objects takes place similar to the way the super-class initializes its objects. Thus, defining constructors explicitly in the sub-class will override or overload super-class constructors. [Read more…] about Overriding Constructors in Java

Constructor Methods in java

By Dinesh Thakur

Constructor methods initialize new objects when they are created. Unlike regular methods, constructor methods cannot be called directly. They are called automatically when a new object is created. When an object is created in Java using the keyword new the following things happen: [Read more…] about Constructor Methods in java

Class methods in Java

By Dinesh Thakur

Apart from class and instance variables, Java also has class and instance methods. The differences between the two types of method are analogous to the differences between class and instance variables. Class methods are available to any instance of the class itself and can be made available to other classes. Therefore, some class methods can be used anywhere, regardless of whether an instance of the class exists or not. [Read more…] about Class methods in Java

Passing Arguments to Methods in Java

By Dinesh Thakur

There are mainly two ways of passing arguments to methods: [Read more…] about Passing Arguments to Methods in Java

Scope of a Variable in Java

By Dinesh Thakur

The scope of a variable specifies the region of the source program where that variable is known, accessible and can be used. In Java, the declared variable has a definite scope. When a variable is defined within a class, its scope determines whether it can be used only within the defined class or outside of the class also. [Read more…] about Scope of a Variable in Java

What is Methods in Java ? – Definition (With Examples)

By Dinesh Thakur

A Java method is a collection of statements, all performing a particular operation.  Let’s say that you were calling the method called System.out.println(); Java executes some different statements that print a message to your console.  We’re going to look at the creation of methods or, as they often called, functions. [Read more…] about What is Methods in Java ? – Definition (With Examples)

What is a Class in Java? – Definition

By Dinesh Thakur

Classes are the fundamental building blocks of any object-oriented language.

A class describes the data and behaviour associated with instances of that class. When a class is instantiated, an object is created: this object has properties and behaviour similar to other instances of the same class. The data associated with a class or object is stored in variables. The behaviour associated with a class or object is implemented by means of methods. Methods are similar to the functions or procedures of procedural languages such as C or Pascal. [Read more…] about What is a Class in Java? – Definition

Benefits of OOP in Java

By Dinesh Thakur

• Code reusability New objects can be derived from old objects, allowing for improvement and refinement of the code at each stage and also preserving parts of the code for other programs. This is used to develop many class libraries using class codes that have already been written, for example, Microsoft Foundation Classes (MFC). [Read more…] about Benefits of OOP in Java

Difference between OOP and Procedure Oriented Programming

By Dinesh Thakur

Now that we know the basic concepts in OOP, we are in a position to compare it with classical procedure oriented programming. [Read more…] about Difference between OOP and Procedure Oriented Programming

Characteristics of OOP in Java

By Dinesh Thakur

In early days, programs were collections of procedures acting on data. A procedure is defined as a collection of instructions executed in sequential order. Data were independent of the procedures and programmers have to keep track of functions and the way they modify data. Structured programming is a simpler way to tackle this situation. [Read more…] about Characteristics of OOP in Java

Objects and Classes in Java

By Dinesh Thakur

Objects and classes are the building blocks of OOP. To understand OOP, first we have to know what objects and classes are. [Read more…] about Objects and Classes in Java

What is ODBC (Open Database Connectivity)?

By Dinesh Thakur

(Open Database Connectivity) An Application Programming Interface published by Microsoft which, by loading the appropriate ODBC driver at run time, enables the same program code to have access to data from many different brands of database. [Read more…] about What is ODBC (Open Database Connectivity)?

« Previous Page
Next Page »

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