Wednesday, January 18, 2017

Java.lang.Short Class

Introduction

The java.lang.Short class wraps a value of primitive type short in an object. An object of type Short contains a single field whose type is short.

Java.lang.StackTraceElement Class

Introduction

The java.lang.StackTraceElement class element represents a single stack frame. All stack frames except for the one at the top of the stack represent a method invocation. The frame at the top of the stack represents the execution point at which the stack trace was generated.

Java.lang.StrictMath Class

Introduction

The java.lang.StrictMath class contains methods for performing basic numeric operations such as the elementary exponential, logarithm, square root, and trigonometric functions.

Java.lang.String Class

Introduction

The java.lang.String class represents character strings. All string literals in Java programs, such as "abc", are implemented as instances of this class.Strings are constant, their values cannot be changed after they are created

Java.lang.StringBuffer Class

Introduction

The java.lang.StringBuffer class is a thread-safe, mutable sequence of characters. Following are the important points about StringBuffer:

Java.lang.StringBuilder Class

Introduction

The java.lang.StringBuilder class is mutable sequence of characters. This provides an API compatible with StringBuffer, but with no guarantee of synchronization.

Java.lang.System Class

Introduction

The java.lang.System class contains several useful class fields and methods. It cannot be instantiated.Facilities provided by System:

Java.lang.Thread Class

Introduction

The java.lang.Thread class is a thread of execution in a program. The Java Virtual Machine allows an application to have multiple threads of execution running concurrently.Following are the important points about Thread:

Java.lang.ThreadGroup Class

Introduction

The java.lang.ThreadGroup class represents a set of threads. It can also include other thread groups. The thread groups form a tree in which every thread group except the initial thread group has a parent.

Java.lang.ThreadLocal Class

Introduction

The java.lang.ThreadLocal class provides thread-local variables.

Class declaration

Java.lang.Throwable Class

Introduction

The java.lang.Throwable class is the superclass of all errors and exceptions in the Java language. Only objects that are instances of this class (or one of its subclasses) are thrown by the Java Virtual Machine or can be thrown by the Java throw statement.

Java.lang.Void Class

Introduction

The java.lang.Void class is an uninstantiable placeholder class to hold a reference to the Class object representing the Java keyword void.

Java.lang.Interfaces

Introduction

The java.lang.Interfaces provides different interfaces used under java lang package.

Interface Summary

Java.lang.Errors

Introduction

The java.lang.Errors provides for different errors thrown under java lang package.

Error Summary

Java.lang.Exceptions

Introduction

The java.lang.Exceptions provides for different exceptions thrown under java lang package.

Exception Summary

Java.lang Useful Resources

The following resources contain additional information on java.lang Please use them to get more in-depth knowledge on this topic.

Discussion Java.lang

Java.util package contains the classes that are fundamental to the design of the Java programming language.
This tutorial cum reference will take you through all the methods available in java.lang package using simple and practical example.

Java.io.BufferedInputStream Class

Introduction

The Java.io.BufferedInputStream class adds functionality to another input stream, the ability to buffer the input and to support the mark and reset methods. Following are the important points about BufferedInputStream:

Java.io.BufferedOutputStream Class

Introduction

The Java.io.BufferedOutputStream class implements a buffered output stream. By setting up such an output stream, an application can write bytes to the underlying output stream without necessarily causing a call to the underlying system for each byte written.

Java.io.BufferedReader Class

Introduction

The Java.io.BufferedReader class reads text from a character-input stream, buffering characters so as to provide for the efficient reading of characters, arrays, and lines.Following are the important points about BufferedReader:

Java.io.BufferedWriter Class

Introduction

The Java.io.BufferedWriter class writes text to a character-output stream, buffering characters so as to provide for the efficient writing of single characters, arrays, and strings.Following are the important points about BufferedWriter:

Java.io.ByteArrayInputStream Class

Introduction

The java.io.ByteArrayInputStream class contains an internal buffer that contains bytes that may be read from the stream. An internal counter keeps track of the next byte to be supplied by the read method.Following are the important points about ByteArrayInputStream:

Java.io.ByteArrayOutputStream Class

Introduction

The Java.io.ByteArrayOutputStream class implements an output stream in which the data is written into a byte array. The buffer automatically grows as data is written to it.Following are the important points about ByteArrayOutputStream:

Java.io.CharArrayReader Class

Introduction

The Java.io.CharArrayReader class implements a character buffer that can be used as a character-input stream.

Java.io.CharArrayWriter Class

Introduction

The Java.io.CharArrayWriter class implements a character buffer that can be used as an Writer. The buffer automatically grows when data is written to the stream.

Java.io.Console Class

Introduction

The Java.io.Console class provides methods to access the character-based console device, if any, associated with the current Java virtual machine.

Java.io.DataInputStream Class

Introduction

The Java.io.DataInputStream class lets an application read primitive Java data types from an underlying input stream in a machine-independent way.Following are the important points about DataInputStream:

Java.io.DataOutputStream Class

Introduction

The Java.io.DataOutputStream class lets an application write primitive Java data types to an output stream in a portable way. An application can then use a data input stream to read the data back in.

Java.io.File Class

Introduction

The Java.io.File class is an abstract representation of file and directory pathnames. Following are the important points about File:

Java.io.FileDescriptor Class

Introduction

The Java.io.FileDescriptor class instances serve as an opaque handle to the underlying machine-specific structure representing an open file, an open socket, or another source or sink of bytes. Following are the important points about FileDescriptor:

Java.io.FileInputStream Class

Introduction

The Java.io.FileInputStream class obtains input bytes from a file in a file system. What files are available depends on the host environment. Following are the important points about FileInputStream:

Java.io.FileOutputStream Class

Introduction

The Java.io.FileOutputStream class is an output stream for writing data to a File or to a FileDescriptor. Following are the important points about FileOutputStream:

Java.io.FilePermission Class

Introduction

The Java.io.FilePermission class represents access to a file or directory.It consists of a pathname and a set of actions valid for that pathname. Following are the important points about FilePermission:

Java.io.FileReader Class

Introduction

The Java.io.FileReader class is a convenience class for reading character files.Following are the important points about FileReader:

Java.io.FileWriter Class

Introduction

The Java.io.FileWriter class is a convenience class for writing character files.Following are the important points about FileWriter:

Java.io.FilterInputStream Class

Introduction

The Java.io.FilterInputStream class contains some other input stream, which it uses as its basic source of data, possibly transforming the data along the way or providing additional functionality. Following are the important points about FilterInputStream:

Java.io.FilterOutputStream Class

Introduction

The Java.io.FilterOutputStream class is the superclass of all classes that filter output streams. Following are the important points about FilterOutputStream:

Java.io.FilterReader Class

Introduction

The Java.io.FilterReader class is for reading filtered character streams. Following are the important points about FilterReader:

Java.io.FilterWriter Class

Introduction

The Java.io.FilterWriter class is for writing filtered character streams. Following are the important points about FilterWriter:

Java.io.InputStream Class

Introduction

The Java.io.InputStream class is the superclass of all classes representing an input stream of bytes. Applications that need to define a subclass of InputStream must always provide a method that returns the next byte of input.

Java.io.InputStreamReader Class

Introduction

The Java.io.InputStreamReader class is a bridge from byte streams to character streams.It reads bytes and decodes them into characters using a specified charset.

Java.io.LineNumberInputStream Class

Introduction

The Java.io.LineNumberInputStream class is an input stream filter that provides the added functionality of keeping track of the current line number. A line is a sequence of bytes ending with a carriage return character ('\r'), a newline character ('\n'), or a carriage return character followed immediately by a linefeed character.

Java.io.LineNumberReader Class

Introduction

The Java.io.LineNumberReader class is a buffered character-input stream that keeps track of line numbers.A line is considered to be terminated by any one of a line feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately by a linefeed.

Java.io.ObjectInputStream Class

Introduction

The Java.io.ObjectInputStream class deserializes primitive data and objects previously written using an ObjectOutputStream. Following are the important points about BufferedInputStream:
  • It is used to recover those objects previously serialized. It ensures that the types of all objects in the graph created from the stream match the classes present in the Java Virtual Machine.
  • Classes are loaded as required using the standard mechanisms.

Class declaration

Following is the declaration for Java.io.ObjectInputStream class:
public class ObjectInputStream
  extends InputStream
    implements ObjectInput, ObjectStreamConstants

Class constructors

S.N. Constructor & Description
1 protected ObjectInputStream()
This provide a way for subclasses that are completely reimplementing ObjectInputStream to not have to allocate private data just used by this implementation of ObjectInputStream.
2 ObjectInputStream(InputStream in)
This creates an ObjectInputStream that reads from the specified InputStream.

Class methods

S.N. Method & Description
1 int available()
This method returns the number of bytes that can be read without blocking.
2 void close()
This method closes the input stream.
3 void defaultReadObject()
This method reads the non-static and non-transient fields of the current class from this stream.
4 protected boolean enableResolveObject(boolean enable)
This method enables the stream to allow objects read from the stream to be replaced.
5 int read()
This method reads a byte of data.
6 int read(byte[] buf, int off, int len)
This method reads into an array of bytes.
7 boolean readBoolean()
This method reads in a boolean.
8 byte readByte()
This method reads an 8 bit byte.
9 char readChar()
This method r a 16 bit char.
10 protected ObjectStreamClass readClassDescriptor()
This method read a class descriptor from the serialization stream.
11 double readDouble()
This method reads a 64 bit double.
12 ObjectInputStream.GetField readFields()
This method reads the persistent fields from the stream and makes them available by name.
13 float readFloat()
This method reads a 32 bit float.
14 void readFully(byte[] buf)
This method reads bytes, blocking until all bytes are read.
15 void readFully(byte[] buf, int off, int len)
This method reads bytes, blocking until all bytes are read.
16 int readInt()
This method reads a 32 bit int.
17 long readLong()
This method reads a 64 bit long.
18 Object readObject()
This method reads an object from the ObjectInputStream.
19 protected Object readObjectOverride()
This method is called by trusted subclasses of ObjectOutputStream that constructed ObjectOutputStream using the protected no-arg constructor.
20 short readShort()
This method reads a 16 bit short.
21 protected void readStreamHeader()
This method is provided to allow subclasses to read and verify their own stream headers.
22 Object readUnshared()
This method reads an "unshared" object from the ObjectInputStream.
23 int readUnsignedByte()
This method reads an unsigned 8 bit byte.
24 int readUnsignedShort()
This method reads an unsigned 16 bit short.
25 String readUTF()
This method reads a String in modified UTF-8 format.
26 void registerValidation(ObjectInputValidation obj, int prio)
This method register an object to be validated before the graph is returned.
27 protected Class<?> resolveClass(ObjectStreamClass desc)
This method loads the local class equivalent of the specified stream class description.
28 protected Object resolveObject(Object obj)
This method will allow trusted subclasses of ObjectInputStream to substitute one object for another during deserialization.
29 protected Class<?> resolveProxyClass(String[] interfaces)
This method returns a proxy class that implements the interfaces named in a proxy class descriptor; subclasses may implement this method to read custom data from the stream along with the descriptors for dynamic proxy classes, allowing them to use an alternate loading mechanism for the interfaces and the proxy class.
30 int skipBytes(int len)
This method skips bytes.

Methods inherited

This class inherits methods from the following classes:
  • Java.io.InputStream
  • Java.io.Object
  • Java.io.ObjectInput

Java.io.ObjectInputStream.GetField Class

Introduction

The Java.io.ObjectInputStream.GetField class provide access to the persistent fields read from the input stream.

Java.io.ObjectOutputStream Class

Introduction

The Java.io.ObjectOutputStream class writes primitive data types and graphs of Java objects to an OutputStream.The objects can be read (reconstituted) using an ObjectInputStream.

Java.io.ObjectOutputStream.PutField Class

Introduction

The Java.io.ObjectOutputStream.PutField class provide programmatic access to the persistent fields to be written to ObjectOutput.

Java.io.ObjectOutputStream Class

Introduction

The Java.io.ObjectOutputStream class writes primitive data types and graphs of Java objects to an OutputStream.The objects can be read (reconstituted) using an ObjectInputStream.

Java.io.ObjectOutputStream.PutField Class

Introduction

The Java.io.ObjectOutputStream.PutField class provide programmatic access to the persistent fields to be written to ObjectOutput.

Java.io.ObjectStreamClass Class

Introduction

The Java.io.ObjectStreamClass class is Serialization's descriptor for classes. It contains the name and serialVersionUID of the class. The ObjectStreamClass for a specific class loaded in this Java VM can be found/created using the lookup method.

Java.io.ObjectStreamField Class

Introduction

The Java.io.ObjectStreamField class is a description of a Serializable field from a Serializable class. An array of ObjectStreamFields is used to declare the Serializable fields of a class.

Java.io.OutputStream Class

Introduction

The Java.io.OutputStream class is the superclass of all classes representing an output stream of bytes. An output stream accepts output bytes and sends them to some sink.Applications that need to define a subclass of OutputStream must always provide at least a method that writes one byte of output.

Java.io.OutputStreamWriter Class

Introduction

The Java.io.OutputStreamWriter class is a bridge from character streams to byte streams. Characters written to it are encoded into bytes using a specified charset.

Java.io.PipedInputStream Class

Introduction

The Java.io.PipedInputStream class is a piped input stream that can be connected to a piped output stream, the piped input stream then provides whatever data bytes are written to the piped output stream.Following are the important points about PipedInputStream:

Java.io.PipedOutputStream Class

Introduction

The Java.io.PipedOutputStream class is a piped output stream that can be connected to a piped input stream to create a communications pipe.Following are the important points about PipedOutputStream:

Java.io.PipedReader Class

Introduction

The Java.io.PipedReader class is piped character-input streams.

Class declaration

Java.io.PipedWriter Class

Introduction

The Java.io.PipedWriter class is piped character-output streams.

Class declaration

Java.io.PrintStream Class

Introduction

The Java.io.PrintStream class adds functionality to another output stream, the ability to print representations of various data values conveniently.

Java.io.PrintWriter Class

Introduction

The Java.io.PrintWriter class prints formatted representations of objects to a text-output stream.

Class declaration

Following is the declaration for Java.io.PrintWriter class:
public class PrintWriter
  extends Writer

Field

Following are the fields for Java.io.PrintWriter class:
  • protected Writer out -- This is the character-output stream of this PrintWriter.
  • protected Object lock -- This is the object used to synchronize operations on this stream.

Class constructors

S.N. Constructor & Description
1 PrintWriter(File file)
This creates a new PrintWriter, without automatic line flushing, with the specified file.
2 PrintWriter(File file, String csn)
This creates a new PrintWriter, without automatic line flushing, with the specified file and charset.
3 PrintWriter(OutputStream out)
This creates a new PrintWriter, without automatic line flushing, from an existing OutputStream.
4 PrintWriter(OutputStream out, boolean autoFlush)
This creates a new PrintWriter from an existing OutputStream.
5 PrintWriter(String fileName)
This creates a new PrintWriter, without automatic line flushing, with the specified file name.
6 PrintWriter(String fileName, String csn)
This creates a new PrintWriter, without automatic line flushing, with the specified file name and charset.
7 PrintWriter(Writer out)
This creates a new PrintWriter, without automatic line flushing.
8 PrintWriter(Writer out, boolean autoFlush)
This creates a new PrintWriter.

Class methods

S.N. Method & Description
1 PrintWriter append(char c)
This method appends the specified character to this writer.
2 PrintWriter append(CharSequence csq)
This method appends the specified character sequence to this writer.
3 PrintWriter append(CharSequence csq, int start, int end)
This method appends a subsequence of the specified character sequence to this writer.
4 boolean checkError()
This method flushes the stream if it's not closed and checks its error state.
5 protected void clearError()
This method Clears the error state of this stream.
6 void close()
This method Closes the stream and releases any system resources associated with it.
7 void flush()
This method Flushes the stream.
8 PrintWriter format(Locale l, String format, Object... args)
This method writes a formatted string to this writer using the specified format string and arguments.
9 PrintWriter format(String format, Object... args)
This method writes a formatted string to this writer using the specified format string and arguments.
10 void print(boolean b)
This method prints a boolean value.
11 void print(char c)
This method prints a character.
12 void print(char[] s)
This method Prints an array of characters.
13 void print(double d)
This method Prints a double-precision floating-point number.
14 void print(float f)
This method prints a floating-point number.
15 void print(int i)
This method prints an integer.
16 void print(long l)
This method prints a long integer.
17 void print(Object obj)
This method prints an object.
18 void print(String s)
This method prints a string.
19 PrintWriter printf(Locale l, String format, Object... args)
This is a convenience method to write a formatted string to this writer using the specified format string and arguments.
20 PrintWriter printf(String format, Object... args)
This is a convenience method to write a formatted string to this writer using the specified format string and arguments.
21 void println()
This method terminates the current line by writing the line separator string.
22 void println(boolean x)
This method prints a boolean value and then terminates the line.
23 void println(char x)
This method prints a character and then terminates the line.
24 void println(char[] x)
This method prints an array of characters and then terminates the line.
25 void println(double x)
This method prints a double-precision floating-point number and then terminates the line.
26 void println(float x)
This method prints a floating-point number and then terminates the line.
27 void println(int x)
This method prints an integer and then terminates the line.
28 void println(long x)
This method prints a long integer and then terminates the line.
29 void println(Object x)
This method prints an Object and then terminates the line.
30 void println(String x)
This method prints a String and then terminates the line.
31 protected void setError()
This method indicates that an error has occurred.
32 void write(char[] buf)
This method writes an array of characters.
33 void write(char[] buf, int off, int len)
This method writes a portion of an array of characters.
34 void write(int c)
This methodWrites a single character.
35 void write(String s)
This method writes a string.
36 void write(String s, int off, int len)
This method writes a portion of a string.

Methods inherited

This class inherits methods from the following classes:
  • Java.io.Object

Java.io.PushbackInputStream Class

Introduction

The Java.io.PushbackInputStream class adds functionality to another input stream, namely the ability to "push back" or "unread" one byte.

Java.io.PushbackReader Class

Introduction

The Java.io.PushbackReader class is a character-stream reader that allows characters to be pushed back into the stream.

Java.io.RandomAccessFile Class

Introduction

The Java.io.RandomAccessFile class file behaves like a large array of bytes stored in the file system.Instances of this class support both reading and writing to a random access file.

Java.io.Reader Class

Introduction

The Java.io.Reader class is a abstract class for reading character streams.

Class declaration

Java.io.SequenceInputStream Class

Introduction

The Java.io.SequenceInputStream class represents the logical concatenation of other input streams. It starts out with an ordered collection of input streams and reads from the first one until end of file is reached, whereupon it reads from the second one, and so on, until end of file is reached on the last of the contained input streams.

Java.io.SerializablePermission Class

Introduction

The Java.io.SerializablePermission class is for Serializable permissions. A SerializablePermission contains a name (also referred to as a "target name") but no actions list; you either have the named permission or you don't.The target name is the name of the Serializable permission.

Java.io.StreamTokenizer Class

Introduction

The Java.io.StreamTokenizer class takes an input stream and parses it into "tokens", allowing the tokens to be read one at a time. The stream tokenizer can recognize identifiers, numbers, quoted strings, and various comment styles.

Class declaration

Following is the declaration for Java.io.StreamTokenizer class:
public class StreamTokenizer
  extends Object

Field

Following are the fields for Java.io.StreamTokenizer class:
  • double nval -- If the current token is a number, this field contains the value of that number.
  • String sval -- If the current token is a word token, this field contains a string giving the characters of the word token.
  • static int TT_EOF -- A constant indicating that the end of the stream has been read.
  • static int TT_EOL -- A constant indicating that the end of the line has been read.
  • static int TT_NUMBER -- A constant indicating that a number token has been read.
  • static int TT_WORD -- A constant indicating that a word token has been read.
  • int ttype -- After a call to the nextToken method, this field contains the type of the token just read.

Class constructors

S.N. Constructor & Description
1 StreamTokenizer(Reader r)
This creates a tokenizer that parses the given character stream.

Class methods

S.N. Method & Description
1 void commentChar(int ch)
Specified that the character argument starts a single-line comment.
2 void eolIsSignificant(boolean flag)
This method determines whether or not ends of line are treated as tokens.
3 int lineno()
This method returns the current line number.
4 void lowerCaseMode(boolean fl)
This method determines whether or not word token are automatically lowercased.
5 int nextToken()
This method parses the next token from the input stream of this tokenizer.
6 void ordinaryChar(int ch)
This method specifies that the character argument is "ordinary" in this tokenizer.
7 void ordinaryChars(int low, int hi)
This method specifies that all characters c in the range low <= c <= high are "ordinary" in this tokenizer.
8 void parseNumbers()
This method specifies that numbers should be parsed by this tokenizer.
9 void pushBack()
This method causes the next call to the nextToken method of this tokenizer to return the current value in the ttype field, and not to modify the value in the nval or sval field.
10 void quoteChar(int ch)
This method specifies that matching pairs of this character delimit string constants in this tokenizer.
11 void resetSyntax()
This method resets this tokenizer's syntax table so that all characters are "ordinary." See the ordinaryChar method for more information on a character being ordinary.
12 void slashSlashComments(boolean flag)
This method determines whether or not the tokenizer recognizes C++ style comments.
13 void slashStarComments(boolean flag)
This method determines whether or not the tokenizer recognizes C style comments.
14 String toString()
This method returns the string representation of the current stream token and the line number it occurs on.
15 void whitespaceChars(int low, int hi)
This method specifies that all characters c in the range low <= c <= high are white space characters.
16 void wordChars(int low, int hi)
This method specifies that all characters c in the range low <= c >= high are word constituents.

Methods inherited

This class inherits methods from the following classes:
  • Java.io.Object

Java.io.StringBufferInputStream Class

Introduction

The Java.io.StringBufferInputStream class allows an application to create an input stream in which the bytes read are supplied by the contents of a string. Applications can also read bytes from a byte array by using a ByteArrayInputStream.Only the low eight bits of each character in the string are used by this class.
This class has been deprecated by Oracle and should not be used any more.

Java.io.StringReader Class

Introduction

The Java.io.StringReader class is a character stream whose source is a string.

Java.io.StringWriter Class

Introduction

The Java.io.StringWriter class is a character stream that collects its output in a string buffer, which can then be used to construct a string.Closing a StringWriter has no effect. The methods in this class can be called after the stream has been closed without generating an IOException.

Java.io.Writer Class

Introduction

The Java.io.Writer class is a abstract class for writing to character streams.

Java.io.Interfaces

Introduction

The java.io.Interfaces provides for system input and output through data streams, serialization and the file system.

Java.io.Exceptions

Introduction

The java.io.Exceptions provides for system input and output through data streams, serialization and the file system.

Discuss Java.io

Java.io package provides classes for system input and output through data streams, serialization and the file system.
This reference will take you through simple and practical methods available in java.io package.

Java - Overview

Java programming language was originally developed by Sun Microsystems which was initiated by James Gosling and released in 1995 as core component of Sun Microsystems' Java platform (Java 1.0 [J2SE]).
The latest release of the Java Standard Edition is Java SE 8.

Java - Environment Setup

In this chapter, we will discuss on the different aspects of setting up a congenial environment for Java.

Try it Option Online

Java - Basic Syntax

When we consider a Java program, it can be defined as a collection of objects that communicate via invoking each other's methods. Let us now briefly look into what do class, object, methods, and instance variables mean.

Java - Object and Classes

Java is an Object-Oriented Language. As a language that has the Object-Oriented feature, Java supports the following fundamental concepts −

Java - Basic Datatypes

Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in the memory.

Java - Variable Types

A variable provides us with named storage that our programs can manipulate. Each variable in Java has a specific type, which determines the size and layout of the variable's memory; the range of values that can be stored within that memory; and the set of operations that can be applied to the variable.

Java - Modifier Types

Modifiers are keywords that you add to those definitions to change their meanings. Java language has a wide variety of modifiers, including the following −
To use a modifier, you include its keyword in the definition of a class, method, or variable. The modifier precedes the rest of the statement, as in the following example.

Example

public class className {
   // ...
}

private boolean myFlag;
static final double weeks = 9.5;
protected static final int BOXWIDTH = 42;

public static void main(String[] arguments) {
   // body of method
}

Access Control Modifiers

Java provides a number of access modifiers to set access levels for classes, variables, methods and constructors. The four access levels are −

Java - Basic Operators

Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups −

Java - Loop Control

There may be a situation when you need to execute a block of code several number of times. In general, statements are executed sequentially: The first statement in a function is executed first, followed by the second, and so on.

Java - Decision Making

Decision making structures have one or more conditions to be evaluated or tested by the program, along with a statement or statements that are to be executed if the condition is determined to be true, and optionally, other statements to be executed if the condition is determined to be false.

Java - Numbers Class

Normally, when we work with Numbers, we use primitive data types such as byte, int, long, double, etc.

Example

int i = 5000;

Java - Character Class

Normally, when we work with characters, we use primitive data types char.

Example

char ch = 'a';

Java - Strings Class

Strings, which are widely used in Java programming, are a sequence of characters. In Java programming language, strings are treated as objects.
The Java platform provides the String class to create and manipulate strings.

Java - Arrays

Java provides a data structure, the array, which stores a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type.

Java - Date and Time

Java provides the Date class available in java.util package, this class encapsulates the current date and time.
The Date class supports two constructors as shown in the following table.

Java - Regular Expressions

Java provides the java.util.regex package for pattern matching with regular expressions. Java regular expressions are very similar to the Perl programming language and very easy to learn.
A regular expression is a special sequence of characters that helps you match or find other strings or sets of strings, using a specialized syntax held in a pattern. They can be used to search, edit, or manipulate text and data.

Java - Methods

A Java method is a collection of statements that are grouped together to perform an operation. When you call the System.out.println() method, for example, the system actually executes several statements in order to display a message on the console.

Java - Files and I/O

The java.io package contains nearly every class you might ever need to perform input and output (I/O) in Java. All these streams represent an input source and an output destination. The stream in the java.io package supports many data such as primitives, object, localized characters, etc.

Java - Exceptions

An exception (or exceptional event) is a problem that arises during the execution of a program. When an Exception occurs the normal flow of the program is disrupted and the program/Application terminates abnormally, which is not recommended, therefore, these exceptions are to be handled.

Java - Inner classes

In this chapter, we will discuss inner classes of Java.

Nested Classes

In Java, just like methods, variables of a class too can have another class as its member. Writing a class within another is allowed in Java. The class written within is called the nested class, and the class that holds the inner class is called the outer class.

Java - Inheritance

Inheritance can be defined as the process where one class acquires the properties (methods and fields) of another. With the use of inheritance the information is made manageable in a hierarchical order.

Java - Overriding

In the previous chapter, we talked about superclasses and subclasses. If a class inherits a method from its superclass, then there is a chance to override the method provided that it is not marked final.

Java - Polymorphism

Polymorphism is the ability of an object to take on many forms. The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object.

Java - Abstraction

As per dictionary, abstraction is the quality of dealing with ideas rather than events. For example, when you consider the case of e-mail, complex details such as what happens as soon as you send an e-mail, the protocol your e-mail server uses are hidden from the user.

Java - Encapsulation

Encapsulation is one of the four fundamental OOP concepts. The other three are inheritance, polymorphism, and abstraction.

Java - Interfaces

An interface is a reference type in Java. It is similar to class. It is a collection of abstract methods. A class implements an interface, thereby inheriting the abstract methods of the interface.

Java - Packages

Packages are used in Java in order to prevent naming conflicts, to control access, to make searching/locating and usage of classes, interfaces, enumerations and annotations easier, etc.