Tutorial by Topics: t

A singleton is a class that only ever has one single instance. For more information on the Singleton design pattern, please refer to the Singleton topic in the Design Patterns tag.
public type name[ = value]; private type name[ = value]; protected type name[ = value]; type name[ = value]; public class name{ class name{ From the Java tutorial: Access level modifiers determine whether other classes can use a particular field or invoke a particular method. There a...
Autoboxing is the automatic conversion that Java compiler makes between primitive types and their corresponding object wrapper classes. Example, converting int -> Integer, double -> Double... If the conversion goes the other way, this is called unboxing. Typically, this is used in Collections ...
Documentation for java code is often generated using javadoc. Javadoc was created by Sun Microsystems for the purpose of generating API documentation in HTML format from java source code. Using the HTML format gives the convenience of being able to hyperlink related documents together. /** -- ...
The Executor interface in Java provides a way of decoupling task submission from the mechanics of how each task will be run, including details of thread use, scheduling, etc. An Executor is normally used instead of explicitly creating threads. With Executors, developers won't have to significantly r...
This documentation page is for showing details with example about java class constructors and about Object Class Methods which are automatically inherited from the superclass Object of any newly created class. public final native Class<?> getClass() public final native void notify() pu...
The 8 primitive data types byte, short, int, long, char, boolean, float, and double are the types that store most raw numerical data in Java programs. int aInt = 8; // The defining (number) part of this int declaration is called a literal. int hexInt = 0x1a; // = 26; You can define literals...
new Socket("localhost", 1234); //Connects to a server at address "localhost" and port 1234 new SocketServer("localhost", 1234); //Creates a socket server that can listen for new sockets at address localhost and port 1234 socketServer.accept(); //Accepts a new Socket...
FileOutputStream openFileInput (String name) FileOutputStream openFileOutput (String name, int mode) File(File dir, String name) File(String path) File getExternalStoragePublicDirectory (String type) File getExternalFilesDir (String type) ParameterDetailsnameThe name of the file to ope...
Optional is a container object which may or may not contain a non-null value. If a value is present, isPresent() will return true and get() will return the value. Additional methods that depend on the presence of the contained value are provided, such as orElse(), which returns a default value if v...
Using HttpUrlConnection on Android requires that you add the Internet permission to your app (in the AndroidManifest.xml). There are also other Java HTTP clients and libraries, such as Square's OkHttp, which are easier to use, and may offer better performance or more features.
In Java, an annotation is a form of syntactic metadata that can be added to Java source code. It provides data about a program that is not part of the program itself. Annotations have no direct effect on the operation of the code they annotate. Classes, methods, variables, parameters and packages ar...
An Android application needs to run on all kinds of devices. Each device may have a different version on Android running on it. Now, each Android version might not support all the features that your app requires, and so while building an app, you need to keep the minimum and maximum Android version...
Date object = new Date(); Date object = new Date(long date); ParameterExplanationNo parameterCreates a new Date object using the allocation time (to the nearest millisecond)long dateCreates a new Date object with the time set to the number of milliseconds since "the epoch" (Januar...
As of Java 8, Calendar and its subclasses have been superseded by the java.time package and its subpackages. They should be preferred, unless a legacy API requires Calendar.
Nashorn is a JavaScript engine developed in Java by Oracle, and has been released with Java 8. Nashorn allows embedding Javascript in Java applications via JSR-223 and allows to develop standalone Javascript applications, and it provides better runtime performance and better compliance with the ECMA...
ParameterDetailsJNIEnvPointer to the JNI environmentjobjectThe object which invoked the non-static native methodjclassThe class which invoked the static native method Setting up JNI requires both a Java and a native compiler. Depending on the IDE and OS, there is some setting up required. A guide...
RMI requires 3 components: client, server and a shared remote interface. The shared remote interface defines the client-server contract by specifying the methods a server must implement. The interface must be visible to the server so that it can implement the methods; the interface must be visible...
The java.util.Iterator is the standard Java SE interface for object that implement the Iterator design pattern. The java.lang.Iterable interface is for objects that can provide an iterator. It is possible to iterate over an array using the for-each loop, though java arrays do not implement Iterab...
Operators in Java programming language are special symbols that perform specific operations on one, two, or three operands, and then return a result. An operator is a symbol (or symbols) that tells a Java program to perform an operation on one, two or three operands. An operator and its opera...

Page 5 of 339