- Core Java — Part 1
- Installation
- Compiling a Java Program —
- To run application program —
- Variables
- Variable Names
- Core Java Tutorial Step By Step for Beginners
- Core Java Tutorial
- Java Introduction
- Basics of Java
- Classes and Objects
- Data Types and Variables
- Java Operators
- Decision Making, Branching, and Looping
- Packages
- Methods
- Constructor
- Modifiers
- Blocks
- Static and Final Keywords
- Inner Classes
- Object-oriented Programming System
- Encapsulation
- Inheritance
- Super and This Keywords
- Method Overloading
- Method Overriding
- Abstraction
- Polymorphism
- Exception Handling
- Collections Framework
- String
- Thread
- Wrapper Class
- Input and Output Stream
- Java Object Input and Output
- Java Arrays
- Annotations
- Garbage Collection
- Generics
- Miscellaneous Tutorials
Core Java — Part 1
Welcome to the first part of three Core Java tutorials. In this series, we’ll discuss the basics of Core Java with practical examples. So let’s get started.
Java is an object-oriented programming language(OOPS). Sun Microsystems developed it in 1995, and it was later acquired by Oracle. It is secure and platform-independent, which means its compiled programs can be run on any operating system. We can run our Java programs on a wide variety of computers using a range of OS (macOS, Windows, Linux, etc.). This is possible because our Java program doesn’t execute directly on our computers. It runs on a standardized hypothetical computer known as Java Virtual Machine (JVM). This JVM is implemented in our computer by a program called Java interpreter. Don’t get confused by the terminology. We will discuss everything in detail. Let’s start with these terms.
- Java Virtual Machine (JVM) — It provides a runtime environment in which Java bytecode can be executed.
- Java Compiler — It compiles the .java file into bytecode. Bytecodes are binary instructions for Java interpreter.
- Java Interpreter — It reads the bytecode and converts it into machine code.
NOTE — Java is platform-independent, but JVM is not. According to the OS, you need to install it into your machine.
Installation
Go to http s: //java. com / en /download/ and download the Java development toolkit(JDK) based on your OS.
After installation, set the path variable.
For Windows users, go to System Properties then Environment Variables . In system variable go to path and enter the path to the bin folder inside your JDK in the variable value. Click OK.
You can confirm that you have installed Java by opening the terminal and running javac command.
Compiling a Java Program —
The below command is used to compile a Java program —
javac is the compiler that compiles our program and creates a file with the extension . class The class file contains bytecodes that are binary instructions for Java interpreter.
To run application program —
The command below is used to run a Java program —
- A Java program is a collection of one or more classes. There is at least one class in every program.
- A Java program file must be saved with the .java extension.
- We must save the program file with the same name as that of the class defined within it.
- We must put the code for each public class in a separate file. (There can be only one public class in a file).
We will discuss what a class is and what is public in this series’s later parts.
Variables
A variable is known as a named value holder in primary memory. When a variable is declared, the compiler is able to check that it is not being used in a manner or context that is inappropriate to its type (type checking).
Example — int x = 10 ; Here x is a variable of integer type. We’ll discuss different data types later.
Variable Names
The name we choose for a variable is called an identifier, and an identifier can be of any length, although it must begin with a letter. The rest of the identifier can include digits. Operators and spaces are not allowed in identifiers. Java variables are case sensitive, which means name and NAME are two different identifiers.
We can’t use Java keywords as a name for something. Keywords are an essential part of the language and are meant for specific purposes.
Below are some examples of valid identifiers —
1 2 3 4
max, Max, MAX ab$123 $ab_123 _abcd
Below are some examples of invalid identifiers —
1 2 3 4 5 6 7
ab + cd ab - cd ab @cd ab cd 123 abcd while final
The last two while and final are reserved keywords.
In general, we follow camel case notation for variables, class, or method names in Java. Below is the example —
HelloWorld, calculateTotal, findMyAge().
That’s all for now for this part. We’ll continue in the next part with DataTypes, Type conversion, and more. Till then, happy coding 🙂
Core Java Tutorial Step By Step for Beginners
Welcome to the online core java tutorial point. Here, you can learn concepts of core java from basic to advanced levels.
This core java tutorial is specially designed for beginners and experienced. It will guide you step by step to learn every concept of the Java programming language.
We have taken great care not only to add a new tutorial but also thoroughly revise and update the existing content regularly so that you can get a better user experience.
If you are a beginner to learn Java programming, this may be the right platform. You can get an overview of the whole Core Java topics below with the link.
In each tutorial, you will also get interview questions and programming exercises to test your understanding.
Core Java Tutorial
Start from here, to learn Java programming. I recommend you see these tutorials in the given order. Even if you have no prior knowledge of Java, you won’t face any difficulty understanding these tutorials.
Because we have covered each Java topic with real-time examples and programs in an easy way. Therefore, you will experience great in learning Java technology.
Java Introduction
- What is Java | Creation, History of Java
- Features of Java | Java Buzzwords
- What is JDK | Java Platform (Ecosystem)
- Bytecode in Java | Bytecode vs Machine code
- What is JRE | Java API, Class Loader
- What is JVM in Java | JVM Architecture, JIT Compiler
- What is Java Compiler | How works it
- Interpreter in Java | Interpreter vs Compiler
- Download and Install Java Development Kit (JDK) in Windows
- First Simple Java Program: Hello World
- Download and Install Eclipse IDE for Java Developers
- Write Simple Java Program in Eclipse IDE, Compile, Run
- C vs Java | 26 Vital Difference between C and Java
- C++ vs Java | 22 Vital Difference between C++ and Java
Basics of Java
Classes and Objects
Data Types and Variables
Java Operators
Decision Making, Branching, and Looping
- Conditional Control Statements in Java
- If Statement in Java | Example Program
- If-else in Java | Nested if-else, Example
- Loops in Java | Types: Nested, Infinite
- While Loop in Java | Example Program
- Java Do while loop
- For loop in Java
- Nested For loop in Java
- For each loop in Java | Enhanced for loop
- Switch Statement in Java | Example Program
- Java Break Statement
- Continue Statement in Java
- Labelled loop in Java | Example Program
Packages
Methods
Constructor
Modifiers
Blocks
Static and Final Keywords
Inner Classes
Object-oriented Programming System
Encapsulation
Inheritance
- Inheritance in Java | Realtime Example
- Superclass and Subclass in Java | Example Program
- Behavior of Access Modifiers in case of Inheritance
- Types of Inheritance in Java
- Top 10 Inheritance Interview Programs for Practice
- Class Relationships in Java
- Has-A Relationship
- Association in Java | Example Program
- Aggregation in Java | Example Program
- Composition in Java | Example Program
- Association vs Aggregation vs Composition
Super and This Keywords
Method Overloading
Method Overriding
Abstraction
Polymorphism
Exception Handling
- Exception Handling in Java | Realtime Example
- Exception Hierarchy in Java
- Checked and Unchecked Exceptions in Java
- Java Try Catch Block with Example
- Multiple Catch Block in Java
- Nested Try, Nested Try Catch in Java
- Finally Block in Java | Example Program
- Return Statement in Try-catch block
- When Finally block is not Executed
- Throw Keyword in Java | Example Program
- Throws Keyword in Java | Example Program
- User-defined Exception in Java with Example
- Chained Exceptions in Java
- Throwable class in Java
- Errors in Java | Runtime and Compile-time Errors
- Exception Handling Interview Programs for Practice
Collections Framework
String
Thread
Wrapper Class
Input and Output Stream
- Java IO Tutorial | Classes, Interfaces
- Stream in Java | Types, Example
- Stream Classes in Java | Byte Stream Classes
- CharacterStream Classes in Java
- FileInputStream Class in Java | Methods, Example
- FileOutputStream Class in Java | Methods, Example
- BufferedInputStream Class | Methods, Example
- BufferedOutputStream Class | Methods, Example
- FilterInputStream Class | Methods, Example
- FilterOutputStream Class | Methods, Example
- DataInputStream Class | Methods, Example
- DataOutputStream Class | Methods, Example
- SequenceInputStream Class | Methods, Example
- PrintStream in Java | Methods, Example
- PushbackInputStream in Java
- RandomAccessFile in Java | Methods, Example
- Reader Class in Java | Methods, Example
- InputStreamReader in Java | Methods, Example
- FileReader in Java with Example
- BufferedReader in Java | Methods, Example
- Writer in Java | Writer Class, Methods
- OutputStreamWriter in Java | Methods, Example
- FileWriter in Java | Example Program
- BufferedWriter in Java | Example Program
- PrintWriter in Java | Example Program
- Scanner Class in Java | Methods, Example
- Console in Java with Example Program
- File in Java | File Class, Example
- How to create a File in Java easily
- How to read a text file in Java
- How to write a file in Java
- How to take input in Java from user or keyboard
- Output formatting in Java using printf() and format()
Java Object Input and Output
Java Arrays
- Arrays in Java | Declaration, Example
- Array Initialization in Java with Example
- One Dimensional Array in Java with Example
- Multidimensional Array in Java | 2D Array, Example
- Three Dimensional Array in Java | 3D Array, Example
- Passing Arrays to Methods in Java
- How to Return Array in Java from a Method
- Arrays Class in Java | Methods, Example
- Array Copy in Java with Example Program
- Linear Array Search | Example Program
- Binary Search in Java for Sorted Array
- Sorting Array in Java with Example Program
- Arrays of Objects in Java with Example Program
Annotations
Garbage Collection
Generics
Miscellaneous Tutorials
Hope that this core java tutorial point has covered all tutorials step by step with basic and advanced example programs. I hope that you will have understood the concepts of core java and enjoyed all the example programs covered in tutorials.
If you’re interested in building a complete software development profile, then you should go for OdinSchool’s Full-Stack Software Development Course, which comes with industry aligned curriculum and 6 months additional placement assistance.
If you find anything incorrect in these tutorials, please inform to Scientech Easy team via email. Your email will be valuable to us.
Thanks for reading.