
Quick Contact
Java Tutorial
- What is Java?
- History of Java
- Hello Java Program
- Features of Java
- Basic Syntax
- Java Setup
- Data Types in Java
- Java Variables
- Operators in Java
- JVM
- Java If-else Statement
- Switch Case Statement
- Java Loops
- Do-While Loop
- Java While Loop
- Continue Statement
- Break Statement in Java
- Constructors in Java
- Oops Concept in Java
- Features of OOPs
- Inheritance
- Exeception handeling
- Aggregation (HAS-A relationship) in Java
- Method Overriding in Java
- Method Overloading
- Java Static Keyword
- Java This Keyword
- Java Final Keyword
- Polymorphism
- Static Binding and Dynamic Binding
- Abstract class in Java
- Access Modifiers in Java
- Difference between abstract class and interface
- Interface in Java
- Garbage Collection in Java
- Java Package
- Encapsulation
- Serialization and Deserialization in Java
- Java Inner Classes
- Java Applets
- Multithreading in Java
- Thread Priorities in Java
- Thread Creation
- Inter Thread Communication
- Wrapper Classes in Java
- Java Input Output
- Java AWT Introduction
- Java Layout Manager
- Java Layout Policy
- Java AWT Events
- Collection Framework
- Collection Framework List Interface
- Swing in Java
- Swing Utility Classes
- Swing Layout Managers
- Java JDBC
- Hibernate Framework Overview – Architecture and Basics
Springboot
- Spring Environment Setup
- Spring Boot CRUD REST API Project using IntelliJ IDEA | Postman | MySQL
- Dockerizing Spring Boot Application | Spring Boot Docker Tutorial
- spring-boot-restapidocumentation with swagger
- Spring Boot HttpClient Overview
- Apache HttpClient POST HTTP Request Example
- Apache HttpClient PUT HTTP Request Example
- Apache HttpClient DELETE HTTP Request Example
- Apache HttpClient HTML Form POST Request Example
- Spring Boot JSP Exampl
- Deploying Spring Boot WAR file with JSP to Tomcat
- Spring Boot Annotations
- Spring Core Annotations
- Spring MVC Annotations with Examples
- Spring Scheduling Annotations
- Spring - Java-based Container Configuration
- Spring Java Based Configuration Example
Hibernate
- Hibernate 5 hello world
- Hibernate- One to One Unidirectional Mapping Annotation Example
- Hibernate - Batch Processing
- Hibernate - Interceptors
- Hibernate 5 - Create, Read, Update and Delete (CRUD) Operations Example
- Hibernate Transaction Management
- Hibernate One to Many Unidirectional Mapping Example
- Hibernate One to Many Bidirectional Mapping Example
- Hibernate Many to Many Annotation Mapping Example
- Hibernate Primary KeyJoin Column
- Hibernate First Level Cache with Example
- Hibernate XML Configuration Example with Maven + Eclipse + MySQL Database
- Hibernate Java Configuration Example
- JPA 2 with Hibernate 5 Bootstrapping Example
- JPA and Hibernate Cascade Types
- Hibernate/JPA - Primary Key Generation
- Hibernate 5 - Enum Type Mapping Example
- Hibernate Component Mapping
- Hibernate Object States – Transient,Persistent and Detached
- Hibernate 5 - Save an Entity Example
- Hibernate 5 - Persist an Entity Example
- Hibernate 5 - saveOrUpdate() Method Example
- Hibernate 5 - get(), load() and byId() Method Examples
- Hibernate 5 - merge() Example
- Hibernate 5 - Delete or Remove an Entity Example
- Hibernate 5 - load() Method Example
- Hibernate Session Interface Methods
- Hibernate Session.clear() Method Example
- Introduction Of Java strutes to Architecture
- Struts 2 - Architecture
- Struts 2 - Configuration Files
- Struts 2 - Actions
- Struts 2 - Interceptors
- Struts 2 - Results & Result Types
- Struts 2 - Value Stack/OGNL
- Struts 2 - File Uploading
- Struts 2 - Database Access
- Struts 2 - Validations Framework
JAVA FX
- JavaFX Tutorial
- Introduction to JavaFX Pane
- JavaFX Popup
- JavaFX group
- JavaFX Controller
- JavaFX Gradient Color
- JavaFXAnchorPane
- JavaFXTabPane
- JavaFX Scene
- JavaFX Stage
- JavaFXWebView
- JavaFX Timeline
- JavaFX Timer
- JavaFX Image
- JavaFX Background
- JavaFX dialog
- JavaFX Font
- JavaFXTextArea
- JavaFXObservableList
- JavaFX GUI
- JavaFX FXML
- JavaFXEventHandler
- JavaFXGradle
- JavafxScrollpane
- JavaFXAPI
Java Variables
A variable gives us named capacity that our code can control. Every variable in Java has a particular sort, which decides the size and format of the variable’s memory; the scope of values that can be put away inside that memory; and the set of operations that can be connected to the variable. You must make an explicit declaration of all variables before they can be utilized.
Variables can be declared in the following manner:
Data type < variable name>;
Here data type is one of Java’s datatypes. On the other hand, a variable is the name or the identifier associated with the variable. To pronounce more than one variable of the pointed out type, you can utilize a comma-divided rundown.
Here are a few examples of declarations:
The following declaration declares three integer variables.
int x, y, z;
In a similar manner, variables of other data types may also be declared.
Java supports three types of variables. These types are as follows:
- Class/static variables
- Instance variables
- Local variables
Local Variables
- Local variables are announced in systems, constructors, or scopes.
- Local variables are made when the constructor or method is entered and the variable will be decimated once it retreats the system, constructor or scope.
- Access modifiers can’t be utilized for neighborhood variables.
- Local variables are noticeable just inside the announced method, constructor or scope.
- Local variables are executed at stack level.
- There is no default value for these variables. So, local variables ought to be declared and a beginning value ought to be relegated before the first utilization.
Sample Implementation:
Here, age is a neighborhood variable. This is characterized inside pupage() strategy and its degree is constrained to this system just.
public class myTest{
open void newfunc(){
int myvar = 1;
myvar = myvar + 10;
System.out.println(“The value of myvar is: ” + myvar);
}
public static void main(string args[]){
mytest = new myTest ();
mytest.myfunc();
}
Output
The output of the execution of this code is:
The value of myvar is: 11
Instance Variables
- The declaration of an instance variable is made inside the class. However, it is made outside the system, constructor or any scope.
- Instance variables are made when an object is made with the utilization of the keyword “new” and obliterated when the item is destroyed.
- When a space is dispensed for an item in the memory, an opening for each one variable value is made.
- Instance variables can be pronounced in class level before or after utilization.
- Instance variables hold values that must be referenced by more than one method, constructor or piece, or key parts of an object’s express that must be available all through the class.
- Access modifiers can be given for sample variables.
- Instance variables have default values. For numbers, the default quality is 0. However, for Booleans, it is false and for object references, it is invalid. Qualities can be relegated amid the statement or inside the constructor.
- The case variables are unmistakable for all methods, constructors and scope in the class. Regularly, it is prescribed to make these variables private (access level). However perceivability for subclasses can be given with the utilization of access modifiers for these variables.
- Instance variables can be gotten to by calling the variable name inside the class.
The following statement can be used for this purpose: Objectreference.variablename.
Sample Implementation:
import java.io.*;
public class Employeerecord{
public String empname;
private double empcompensation;
public Employee (String name){
empname = name;
}
public void initsalary(double empsalary){
empcompensation = empsalary;
}
public void printemployee(){
System.out.println(“Employee name : ” + empname );
System.out.println(“Employee salary :” + empcompensation);
}
public static void main(string args[]){
Employeerecord employee1 = new Employeerecord(“Mary”);
employee1.initsalary(7500);
employee1.printemployee();
}
Output
The compilation and execution would deliver the accompanying result:
Employee name: Mary
Employee compensation: 7500.0
Class/Static Variables
- Class variables otherwise called static variables are declared with the static keyword in a class, yet outside a constructor, method or scope.
- There would just be one duplicate of each class variable for every class, paying little mind to what number of objects are made from it.
- Static variables are seldom utilized other than being pronounced as constants. Constants are variables that are announced as private/public, static and final. Consistent variables never show signs of change from their introductory quality.
- Static variables are put away in static memory. It is uncommon to utilize static variables other than announced final and utilized as either private or public constants.
- Static variables are made when the system begins and annihilated when the execution stops.
- Visibility is like instance variables. In any case, most static variables are announced public since they must be accessible for clients of the class.
- Default values for these variables are also same as instance variables. For numbers, the default value id typically 0. However, the same value for Booleans is false and for object reference is invalid. Values can be doled out amid the assertion or inside the constructor. Furthermore, values can be appointed in unique static initializer brackets.
- Static variables can be gotten to by calling with the class name.
Classname.variablename.
- When announcing class variables as public static final, variables names (constants) must all be in upper case. Moreover, the static variables are not public and the naming convention is the same as local and instance variables.
Sample Implementation:
import java.io.*;
public class Employeerecord{
private static double empcompensation;
public static final String empdept = “HR “;
empcomp = 7500;
System.out.println(empdept+” Compensation: “+empcompensation);
}
Output
The compilation and execution of this code shall create the accompanying result:
HR Compensation: 7500
Modifier Types
Modifiers are catchphrases that you add to definitions to change their implications. The Java programming language has a wide and mixed bag of modifiers, including the accompanying:
- Non-Access Modifiers
- Java Access Modifiers
In order to utilize a modifier, you incorporate its catchphrase in the meaning of a class, variable or method. The modifier goes before whatever is left of the announcement.
Access Control Modifiers:
Java gives various access modifiers to set access levels for classes, variables, routines and constructors. The four right to gain access are:
- Private: visible to the class.
- Default: visible to the bundle. No modifiers are required.
- Secured: visible to all subclasses and package.
- Public: visible to the world.
Apply Now for Advanced Java Training Course