Java Tutorial

Java Website
YouTube/Video Tutorial Links

Java Tutorial Links for Beginners

Java Tutorial


Job Titles

Java Developer, Java Technical Architect


Java Alternatives

Python, C++, JavaScript, Node.js


Java Certification

Oracle Certified Associate, Java SE 8 Programmer

Java EE Training & Certification


Java Interview Questions


Applications that Run on Java
  • Desktop GUI Applications: Java provides GUI development through various means like Abstract Windowing Toolkit (AWT), Swing and JavaFX. …
  • Mobile Applications: …
  • Embedded Systems: …
  • Web Applications: …
  • Web Servers and Application Servers: …
  • Enterprise Applications: …
  • Scientific Applications:
Application development in Java

Sun Java Studio Enterprise IDE is a powerful set of tools that provides an integrated framework for enterprise-grade, rapid web application development. It offers enhanced debugging and development support for web services and for development of Java EE technology-based applications.


Uses of Java

Java was designed to have the look and feel of the C++ language, but it is simpler to use than C++ and enforces an object-oriented programming model. Java can be used to create complete applications that may run on a single computer or be distributed among servers and clients in a network.


Java programming language

It is an object oriented language. Its syntax is common as C and C++. It was released in 1995 as a part of Sun Microsystems’ Java platform. Java programs are compiled to byte code (class file) that can run on any Java Virtual Machine (JVM), making Java a platform independent programming language.


What are arrays in multiplication

An arrangement of objects, pictures, or numbers in columns and rows is called an array. Arrays are useful representations of multiplication concepts. This array has 4 rows and 3 columns. It can also be described as a 4 by 3 array.


Are arrays initialized to 0 in Java

From the Java Language Specification: Each class variable, instance variable, or array component is initialized with a default value when it is created (§15.9, §15.10): For type byte, the default value is zero, that is, the value of (byte)0.


Is an array an object in Java

An object is a class instance or an array. Yes, the Java Language Specification writes: In the Java programming language, arrays are objects (§4.3.1), are dynamically created, and may be assigned to variables of type Object (§4.3.2). All methods of class Object may be invoked on an array.


Maximum size of an array in Java

In Java, arrays internally use integers (int not Integer) for index, the max size is limited by the max size of integers. So theoretically it is 2^31-1 = 2147483647, which is Integer.MAX_VALUE. But in recent HotSpot JVM it has been observed that the max size of array can be Integer.MAX_VALUE – 5.


Arrays in Java

An array is a group of like-typed variables that are referred to by a common name.Arrays in Java work differently than they do in C/C++. Following are some important point about Java arrays.

  • In Java all arrays are dynamically allocated.(discussed below)
  • Since arrays are objects in Java, we can find their length using member length. This is different from C/C++ where we find length using sizeof.
  • A Java array variable can also be declared like other variables with [] after the data type.
  • The variables in the array are ordered and each have an index beginning from 0.
  • Java array can be also be used as a static field, a local variable or a method parameter.
  • The size of an array must be specified by an int value and not long or short.
  • The direct superclass of an array type is Object.


OOPS concepts in Java

We will use java programming language for code examples, so that you know how to implement OOPS concepts in java.

  • Abstraction. Abstraction is the concept of hiding the internal details and describing things in simple terms. …
  • Encapsulation. …
  • Polymorphism. …
  • Inheritance. …
  • Association. …
  • Aggregation. …
  • Composition.


What is meant by oops concept

Object-oriented programming (OOP) refers to a type of computer programming (software design) in which programmers define not only the data type of a data structure, but also the types of operations (functions) that can be applied to the data structure.


Basic concept of Oops

Introduction to Object Oriented Programming (OOP) concepts in C#: Abstraction, Encapsulation, Inheritance and Polymorphism. OOP Features. Object Oriented Programming (OOP) is a programming model where programs are organized around objects and data rather than action and logic.


What is the meaning of data type in Java?

Data type specifies the size and type of values that can be stored in an identifier. The Java language is rich in its data types. … Data types in Java are classified into two types: Primitive—which include Integer, Character, Boolean, and Floating Point. Non-primitive—which include Classes, Interfaces, and Arrays.


What are the 8 data types in Java?

Primitive types are the most basic data types available within the Java language. There are 8: boolean , byte , char, short , int , long , float and double .


What are the primitive data types in Java?

There are 8 primitive types:

  • byte.
  • short.
  • int.
  • long.
  • char.
  • float.
  • double.
  • boolean.


What are the 4 primitive data types?

Classic basic primitive types may include:

  • Character ( character , char );
  • Integer ( integer , int , short , long , byte ) with a variety of precisions;
  • Floating-point number ( float , double , real , double precision );
  • Fixed-point number ( fixed ) with a variety of precisions and a programmer-selected scale.


What is meant by exception handling in Java?

Exceptions are events that occur during the execution of programs that disrupt the normal flow of instructions (e.g. divide by zero, array access out of bound, etc.). In Java, an exception is an object that wraps an error event that occurred within a method and contains: Information about the error including its type.


What is checked and unchecked exception?

In Java, there two types of exceptions: 1) Checked: are the exceptions that are checked at compile time. … Consider the following Java program. It compiles fine, but it throws Arithmetic Exception when run. The compiler allows it to compile, because Arithmetic Exception is an unchecked exception.


What is an exception handling?

Exception handling is the process of responding to the occurrence, during computation, of exceptions – anomalous or exceptional conditions requiring special processing – often changing the normal flow of program execution.


What is the use of try in Java?

The try block contains set of statements where an exception can occur. A try block is always followed by a catch block, which handles the exception that occurs in associated try block. A try block must be followed by catch blocks or finally block or both.


Java Files Class
  • Java Files class contains static methods that work on files and directories.
  • This class is used for basic file operations like create, read, write, copy and delete the files or directories of the file system.


Garbage Collection in Java
  • the programmer need not to care for all those objects which are no longer in use. Garbage collector destroys these objects.
  • Garbage collector is best example of Daemon thread as it is always running in background.
  • Main objective of Garbage Collector is to free heap memory by destroying unreachable objects.


Java history

Java was originally developed by James Gosling at Sun Micro systems (which has since been acquired by Oracle Corporation) and released in 1995 as a core component of Sun Micro systems Java platform. The language derives much of its syntax from C and C++, but it has fewer low-level facilities than either of them.


Who is owner of Java?

Sun Micro systems created Java. Oracle bought Sun, and thus they became the owners of Java. Java (JVM and JDK) is open source, and you are free to use it. This is under the GPL though, and if they do any changes to the actual JVM or JDK, they will have to release those changes.


Why is it called Java?

The language was initially called Oak after an oak tree that stood outside Gosling’s office. Later the project went by the name Green and was finally renamed Java, from Java coffee. Gosling designed Java with a C/C++-style syntax that system and application programmers would find familiar.


Why Java is named as oak?

Oak is a discontinued programming language created by James Gosling in 1991, initially for Sun Microsystems’ set-top box project. The language later evolved to become Java. The name Oak was used by Gosling after an oak tree that stood outside his office.


What is Java buzzwords?

Java Buzzwords. Simple, Secure, Portable, Object-oriented, Robust, Multithreaded, Architecture-neutral, Interpreted, High Performance, Distributed and Dynamic are the Java buzzwords.


Inheritance in Java

Inheritance is an important pillar of OOP(Object Oriented Programming). It is the mechanism in java by which one class is allow to inherit the features(fields and methods) of another class. … The subclass can add its own fields and methods in addition to the superclass fields and methods.


Can you inherit private variables Java?

A subclass does not inherit the private members of its parent class. However, if the superclass has public or protected methods for accessing its private fields, these can also be used by the subclass.


Can we inherit abstract class in Java?

Abstract classes cannot be instantiated, but they can be subclassed. When an abstract class is subclassed, the subclass usually provides implementations for all of the abstract methods in its parent class. However, if it does not, then the subclass must also be declared abstract.


Why does Java does not support multiple inheritance?

C++ , Common lisp and few other languages supports multiple inheritance while java doesn’t support it. Java doesn’t allow multiple inheritance to avoid the ambiguity caused by it. One of the example of such problem is the diamond problem that occurs in multiple inheritance.


What are the access modifiers in Java?

Java provides a number of access modifiers to set access levels for classes, variables, methods, and constructors. The four access levels are − Visible to the package, the default. No modifiers are needed. Visible to the class only (private).


What is meant by j2ee in Java?

J2EE is a platform-independent, Java-centric environment from Sun for developing, building and deploying Web-based enterprise applications online. The J2EE platform consists of a set of services, APIs, and protocols that provide the functionality for developing multitiered, Web-based applications.


What are Java EJBS?

Enterprise JavaBeans (EJB) is one of several Java APIs for modular construction of enterprise software. EJB is a server-side software component that encapsulates business logic of an application. … The EJB specification is a subset of the Java EE specification.


What are the j2ee technologies?

J2EE is comprised of many APIs that can be used to build enterprise applications. … For completeness, however, the full list of technologies that make up J2EE is as follows: Java Servlets. JavaServer Pages (JSP) Enterprise JavaBeans (EJB).


Which is a reserved word in the Java?

Java reserved words are keywords that are reserved by Java functions or other uses that cannot be used as identifiers (e.g., variable names, function names, class names). If a reserved word was used as a variable you would get an error or unexpected result. The list of reserved words in Java is provided below.


What are the operators in Java?
  • Unary Operator,
  • Arithmetic Operator,
  • shift Operator,
  • Relational Operator,
  • Bitwise Operator,
  • Logical Operator,
  • Ternary Operator and.
  • Assignment Operator.


What is the use of native keyword in Java?

The native keyword is applied to a method to indicate that the method is implemented in native code using JNI (Java Native Interface). It marks a method, that it will be implemented in other languages, not in Java. It works together with JNI (Java Native Interface).


Java Language Keywords
abstract continue for new switch
assert*** default goto* package synchronized
boolean do if private this
break double implements protected throw
byte else import public throws
case enum**** instanceof return transient
catch extends int short try
char final interface static void
class finally long strictfp** volatile
const* float native super While
Multithreading in Java

Multithreading in java is a process of executing multiple threads simultaneously. Thread is basically a lightweight sub-process, a smallest unit of processing. Multiprocessing and multithreading, both are used to achieve multitasking. But we use multithreading than multiprocessing because threads share a common memory area. They don’t allocate separate memory area so saves memory, and context-switching between the threads takes less time than process. Java Multithreading is mostly used in games, animation etc.


What is meant by method in Java?

A method is a set of code which is referred to by name and can be called (invoked) at any point in a program simply by utilizing the method’s name. Think of a methodas a subprogram that acts on data and often returns a value. Each method has its own name.


What is the method body in Java?

Besides regular Java language elements, you can use this in the method body to refer to members in the current object. The current object is the object whose method is being called. You can also use super to refer to members in the superclass that the current object has hidden or overridden.


What is the use of equals method in Java?

However it is possible to override the hashCode method in your implementation class. This particular method is used to make equal comparison between two objects. There are two types of comparisons in Java. One is using “= =” operator and another is “equals()”.


What is a method declaration in Java?

A method in Java is a block of statements that has a name and can be executed by calling (also called invoking) it from some other place in your program. Along with fields, methods are one of the two elements that are considered members of a class. (Constructors and initializers are not considered class members.)


What is a token in programming?

A programming token is the basic component of source code . Character s are categorized as one of five classes of tokens that describe their functions (constants, identifiers, operators, reserved words, and separators) in accordance with the rules of the programming language.


What are the keywords in Java?

In the Java programming language, a keyword is one of 50 reserved words that have a predefined meaning in the language; because of this, programmers cannot use keywords as names for variables, methods, classes, or as any other identifier.


What do you mean by command line argument in Java?

The command line argument is the argument passed to a program at the time when you run it. To access the command-line argument inside a java program is quite easy, they are stored as string in String array passed to the args parameter of main() method.



5/5 (2 Reviews)
Scroll to Top