Java Programming Tutorials
Write Once Run Anywhere

Java Tutorials
Article By The Techie King
Java is a popular programming language, created in 1995.It is owned by Oracle, and more than 3 billion devices run Java. Java is guaranteed to be Write Once, Run Anywhere. IN the Java programming language, all source code is first written in plain text files ending with the .java extension. Those source files are then compiled into .class files by the javac compiler. A .class file does not contain code that is native to your processor; it instead contains bytecodes — the machine language of the Java Virtual Machine1 (Java VM). The java launcher tool then runs your application with an instance of the Java Virtual Machine.
- Mobile applications (Android apps)
- Desktop applications(Swing)
- Web applications
- Web servers and application servers
- Games
- Database connection
- Advantages of Java Programming
- Object Oriented In Java, everything is an Object. Java can be easily extended since it is based on the Object model.
- Platform Independent - Unlike many other programming languages including C and C++, when Java is compiled, it is not compiled into platform specific machine, rather into platform independent byte code. This byte code is distributed over the web and interpreted by the Virtual Machine (JVM) on whichever platform it is being run on.
- Simple - Java is designed to be easy to learn. If you understand the basic concept of OOP Java, it would be easy to master.
- Secure - With Java's secure feature it enables to develop virus-free, tamper-free systems. Authentication techniques are based on public-key encryption.
- Robust - Java makes an effort to eliminate error prone situations by emphasizing mainly on compile time error checking and runtime checking.
- Portable - Being architecture-neutral and having no implementation dependent aspects of the specification makes Java portable
What is an object in Java
An entity that has state and behavior is known as an object e.g., mobile, account, marker, pen, chair, car, etc. It can be physical or logical. The example of an intangible object is the banking system.
Characteristics of object
State: represents the data (value) of an object
Behavior: represents the behavior (functionality) of an object such as deposit, withdraw, etc
Identity: An object identity is typically implemented via a unique ID. The value of the ID is not visible to the external user. However, it is used internally by the JVM to identify each object uniquely
Object Definitions
- An object is a real-world entity.
- An object is a runtime entity.
- The object is an entity which has state and behavior.
- The object is an instance of a class.
What is a class in Java
A class is a group of objects which have common properties. It is a template or blueprint from which objects are created. It is a logical entity. It can't be physical.
A class in Java can contain below
- Fields.
- Methods.
- Constructors.
- Blocks.
- Nested class and interface.
What is OOPs?
Object-Oriented Programming is a paradigm that provides many concepts, such as Inheritance, Abstraction, Polymorphism,Encapsulation etc.
The concept of "objects", which can contain data and code: data in the form of fields, and code, in the form of procedures. A feature of objects is that an object's own procedures can access and often modify the data fields of itself.
OOPs Concepts are as follows
- Class
- Object
- Method and method passing
- Pillars of OOPS
- Abstraction
- Encapsulation
- Inheritance
- Polymorphism
What is class in java?
A class is a user defined blueprint or prototype from which objects are created. It represents the set of properties or methods that are common to all objects of one type. In general, class declarations can include these components
- Modifiers: A class can be public or has default access.
- Class name: The name should begin with a initial letter
- Superclass: The name of the class’s parent, if any, preceded by the keyword extends. A class can only extend one parent.
Interfaces: A comma-separated list of interfaces implemented by the class, if any, preceded by the keyword implements. A class can implement more than one interface.
Body: The class body surrounded by { } braces.
What is an object in Java?
An entity that has state and behavior is known as an object e.g., chair, bike, mobile, pen, table, bike, etc. It can be physical or logical. The example of an intangible object is the banking system.
An object has three characteristics
- State: represents the data of an object.
- Behavior: represents the behavior of an object such as deposit, withdraw, etc.
- Identity: An object identity is typically implemented via a unique ID. The value of the ID is not visible to the external user. However, it is used internally by the JVM to identify each object uniquely.
Object Definitions
- An object is a real-world entity.
- The object is an entity which has state and behavior.
- An object is a runtime entity.
- The object is an instance of a class.
Methods in Java
A method in Java or Java Method is a collection of statements that perform some specific task and return the result to the caller. A Java method is a collection of statements that are grouped together to perform an operation.
Methods in Java allow us to reuse the code without retyping the code. In Java, every method must be part of some class that is different from languages like C, C++, and Python.
Types of Methods in Java
Predefined Method: In Java, predefined methods are the method that is already defined in the Java class libraries is known as predefined methods. It is also known as the standard library method or built-in method.
User-defined Method: The method written by the user or programmer is known as a user-defined method. These methods are modified according to the requirement.
Method Declaration
Modifier: It defines the access type of the method i.e. from where it can be accessed in your application. In Java, there 4 types of access specifiers(public,protected,private,default) .
Method Name: the rules for field names apply to method names as well, but the convention is a little different.
The return type: The data type of the value returned by the method or void if does not return a value.
Parameter list: Comma-separated list of the input parameters is defined, preceded with their data type, within the enclosed parenthesis. If there are no parameters, you must use empty parentheses.
Method body: it is enclosed between braces. The code you need to be executed to perform your intended operations.
Exception list: The exceptions you expect by the method can throw, you can specify these exception
Naming a Method
While defining a method, remember that the method name must be a verb and start with a lowercase letter. If the method name has more than two words, the first name must be a verb followed by adjective or noun. In the multi-word method name, the first letter of each word must be in uppercase except the first word.
Pillars of OOPS
About the Creator
The Techie King
The Techie King web store provides some links which gives you free spins, coins, credits, chips and slots as well as programming language tutorial




Comments
There are no comments for this story
Be the first to respond and start the conversation.