Java Programming Language
Java is one of the most popular and widely used programming language.
- Java has been one of the most popular programming language for many years.
- Java is Object Oriented. However it is not considered as pure object oriented as it provides support for primitive data types (like int, char, etc)
- The Java codes are first compiled into byte code (machine independent code). Then the byte code runs on Java Virtual Machine (JVM) regardless of the underlying architecture.
- Java syntax is similar to C/C++. But Java does not provide low level programming functionalities like pointers. Also, Java codes are always written in the form of classes and objects.
- Java is used in all kind of applications like Mobile Applications (Android is Java based), desktop applications, web applications, client server applications, enterprise applications and many more.
- When compared with C++, Java codes are generally more maintainable because Java does not allow many things which may lead bad/inefficient programming if used incorrectly. For example, non-primitives are always references in Java. So we cannot pass large objects (like we can do in C++) to functions, we always pass references in Java. One more example, since there are no pointers, bad memory access is also not possible.
- When compared with Python, Java kind of fits between C++ and Python. The programs written in Java typically run faster than corresponding Python programs and slower than C++. Like C++, Java does static type checking, but Python does not.
Simple Hello World Program :
// A Java program to print "Hello World" public class GFG { public static void main(String args[]) { System.out.println("Hello World"); } }
Output :
Hello World
Overview, Basics, OOP concepts, Inheritance Operators, Strings, Input and Output, Arrays , Arrays Class, Important Keywords in Java ,Java vs C++, Methods in Java, Constructors, Exception Handling, Interfaces and Abstract Classes, Java Packages, Multithreading, Garbage Collection, Wrapper Classes, Reflection in Java, File Handling, Collection in Java, Collection Interview FAQ’s ,Collections Class (Contains utility functions on Collections), Useful and/or Advanced Features, Image Processing, Networking in Java, Interview Questions, Misc, Multiple Choice Questions, Java 8 Stream Methods
- How to start learning Java
- Setting up the environment
- The Hello World Example(Practice)
- Java Naming Conventions
- JVM
- JVM Stack Area
- JVM Shutdown Hook
- Java Class File
- Differences between JDK, JRE and JVM
- Does JVM create object of Main class?
- How is Java platform independent?
- JDBC Drivers
- Is main method compulsory in Java?
- File names and class names
- How to run java class file which is in different directory?
- Microservices Introduction
- Using predefined class name as Class or Variable name in Java
- How do I become a good Java programmer?
- Java Identifiers
- Data types
- How to define our own data type in java(enum)
- Enum with Customized Value
- StringBuffer appendCodePoint() Method
- Variables
- Scope of Variables
- Final variables
- Bounded Type Parameters
- Loops in Java(Practice)
- For-each loop in Java
- For Loop in Java | Important points
- Decision Making(if, if-else, switch, break, continue, jump)(Practice)
- Switch Statement in Java(Practice)
- String in Switch Case in Java
- Forward declarations
- Widening Primitive Conversion
- Type conversion in Java
- Comments in Java
- Does Java support goto?
- Interesting facts about null in Java
- Using _ (underscore) as variable name
- Currying Functions in Java with Examples
- Using underscore in Numeric Literals
- Binary search in Java
- Sorting in Java
- Classes and Objects
- Java object storage
- Different ways to create objects in Java
- How to swap or exchange objects
- Inheritance in Java
- Encapsulation in Java
- Abstraction in Java
- Run-time Polymorphism in Java
- Association,Composition and Aggregation
- Access and Non Access Modifiers in Java
- Access Modifiers
- this reference
- Method Overloading
- Output of Java program | Set 22 (Overloading)
- Method Overriding
- Output of Java program | Set 18 (Overriding)
- Understanding “static” in “public static void main” in Java
- Overloading or Overriding static methods
- Shadowing of static methods(Also called Method Hiding)
- Static methods vs Instance methods in Java
- Assigning values to static final variables in Java
- Covariant return types
- Object class
- Static class in Java
- Flexible nature of java.lang.Object
- Overriding equals method of Object class
- Overriding toString() method of Object class
- Instance Variable Hiding
- Static blocks in Java
- initializer block in java
- instance initializer block in java(non-static block)
- Static vs Dynamic Binding
- Why Java is not a purely Object-Oriented Language?
- Understanding Classes and Objects in Java
- Inheritance in Java
- Multiple Inheritance
- Why Java does’nt support Multiple Inheritance – The Diamond Problem
- Java Object Creation of Inherited Class
- Inheritance and constructors
- Interfaces and Inheritance
- Using final with Inheritance
- Accessing Grandparent’s member
- Override private methods
- More restrictive access to a derived class method in Java
- Parent and Child classes having same data member
- Object Serialization with Inheritance
- Referencing Subclass objects with Subclass vs Superclass reference
- Does overloading work with inheritance
- Output of Java Program | Set 20 (Inheritance)
- String Class(Practice)
- StringBuffer Class
- StringBuilder Class
- StringTokenizer class – Set 1, Set 2
- StringJoiner in Java8
- Implementations:
- Initialize and Compare Strings
- String vs StringBuilder vs StringBuffer
- When to use StringJoiner over StringBuilder?
- Integer to String Conversions
- String to Integer– parseInt()
- Swap two Strings without using third variable
- Searching characters and substring in a String
- Compare two Strings in Java
- Reverse a string in Java (5 Different Ways)
- Remove Leading Zeros From String in Java
- Trim (Remove leading and trailing spaces) a string
- Counting number of lines, words, characters and paragraphs in a text file using Java
- Check if a string contains only alphabets in Java using Lambda expression
- Remove elements from a List that satisfy given predicate in Java
- Check if a string contains only alphabets in Java using ASCII values
- Check if a string contains only alphabets in Java using Regex
- More >>
- Arrays in Java(Practice)
- Default Array values
- Util Arrays Class (Contains utility functions for Arrays)
- Reflect Array class in Java
- util.Arrays vs reflect.Array in Java
- Final arrays
- Interesting facts about Array assignment in Java
- Jagged Array
- Array IndexOutofbounds Exception
- Array vs ArrayList in Java
- Implementations:
- C++ vs Java
- Static keyword in C++ vs Java
- Exception Handling in C++ vs Java
- Inheritance in C++ vs Java
- Virtual behavior differ in C++ vs Java
- Foreach in C++ and Java
- C/C++ Pointers vs Java References
- Comparison of boolean data type in C++ and Java
- Floating Point Operations & Associativity in C, C++ and Java
- Methods
- Parameters passing
- Returning Multiple values
- Throwable fillInStackTrace() method in Java
- Valid variants of main()
- Variable Arguments (Varargs) method
- Method Overloading
- Different ways of Method Overloading in Java
- Method overloading and null error
- Method Overloading with Autoboxing and Widening
- Method Overloading and Ambiguity in Varargs
- Overloading main()
- Overriding equals method
- Overriding toString() method
- Private and final methods
- Java is Strictly Pass by Value
- Clone() method
- Remote Method Invocation
- Default Methods
- Passing and Returning Objects in Java
- Date after() method in Java
- System.exit() method
- Exceptions
- OutOfMemoryError Exception
- 3 Different ways to print Exception messages in Java
- flow control in try-catch-finally
- Types of Exceptions
- Catching base and derived classes as exceptions
- Checked vs Unchecked Exceptions
- Throw and Throws
- User-defined Custom Exception
- Infinity or Exception?
- Multicatch
- Chained Exceptions
- Null Pointer Exception
- Output of Java program | Set 12(Exception Handling)
- Interfaces
- Access specifier for methods in interfaces
- Access specifiers for classes or interfaces
- Abstract Classes
- Difference between Abstract Class and Interface in Java
- Comparator Interface
- Java Interface methods
- Nested Interface
- Nested Classes in Java
- Inner class in java
- Local Inner Class in Java
- Anonymous Inner Class in Java
- Functional Interfaces
- What is a Marker interface
- Questions on Abstract Classes and Interfaces
- Output of Java program | Set 15 (Inner Classes)
- Static method in Interface in Java
- Function Interface in Java with Examples
- Collection:
- List:
- Queue:
- Deque:
- ArrayDeque
- java.util.Concurrent:
- Set:
- Map:
- HashTable
- Stack
- Vector
- Multithreading
- Lifecycle and states of a thread
- Main thread
- Methods to prevent thread execution
- inter thread communication
- Java.lang.Thread class
- Start() function in multithreading
- Java Thread Priority
- Joining Threads in Java
- Naming a thread and fetching name of current thread in Java
- Synchronization
- Method and Block Synchronization
- Producer-Consumer solution
- Thread Pools in Java
- Semaphore in Java
- Java.util.concurrent.Semaphore class in Java
- CountDownLatch
- Deadlock in java
- Daemon thread
- Reentrant Lock
- Cyclic Barrier in Java
- Callable and Future in Java
- Runtime Class
- Output of Java program | Set 16 (Threads)
- File class
- Ways of Reading a text file in Java
- file permissions in java
- Moving a file from one directory to another using Java
- Copying file using FileStreams
- Delete a file using Java
- Java program to delete duplicate lines in text file
- Java program to merge two files alternatively into third file
- Java program to List all files in a directory and nested sub-directories | Recursive approach
- Java program to delete certain text from a file
- Check if a File is hidden in Java
- Redirecting System.out.println() output to a file
- Introduction
- Unit Class in JavaTuples
- Pair Class in JavaTuples
- Triplet Class in JavaTuples
- Quartet Class in JavaTuples
- Quintet Class in JavaTuples
- Sextet Class in JavaTuples
- Septet Class in JavaTuples
- Octet Class in JavaTuples
- Ennead Class in JavaTuples
- Decade Class in JavaTuples
- LabelValue Class in JavaTuples
- KeyValue Class in JavaTuples
- Implement Pair Class with Unit Class in Java using JavaTuples
- Implement Quartet Class with Triplet Class in Java using JavaTuples
- Implement Triplet Class with Pair Class in Java using JavaTuples
- Implement Decade Class from Ennead Class in Java using JavaTuples
- Implement Ennead Class from Octet Class in Java using JavaTuples
- Implement Septet Class from Sextet Class in Java using JavaTuples
- Implement Octet Class from Septet Class in Java using JavaTuples
- Implement Sextet Class from Quintet Class in Java using JavaTuples
- Implement Quintet Class with Quartet Class in Java using JavaTuples
- Set 1 (Read and Write)
- Set 2 (Get and Set Pixels)
- Set 3 (Colored image to greyscale image conversion)
- Set 4 (Colored image to Negative image conversion)
- Set 5 (Colored to Red Green Blue Image Conversion)
- Set 6 (Colored image to Sepia image conversion)
- Set 7 (Creating a random pixel image)
- Image Processing in Java | Set 8 (Creating mirror image)
- Set 9 ( Face Detection )
- Set 10 ( Watermarking an image )
- Set 11 (Changing orientation of image)
- Set 12 ( Contrast Enhancement )
- Set 13 (Brightness Enhancement)
- Set 14 ( Sharpness Enhancement )
- Set 14 ( Comparison of two images )
- Compressing and Decompressing files in Java
- Boolean Class in Java
- Byte Class in Java
- Character Class in Java
- Character.Subset Class in Java
- Character.UnicodeBlock Class in Java
- Class
Class in Java Set 1, Set 2 - Compiler Class in Java
- Double Class in Java
- Enum
Class in Java - Float Class in Java
- InheritableThreadLocal
Class in Java - Integer Class in Java
- Long Class in Java
- Math Class in Java Set 1, Set 2
- Number Class in Java
- Object Class in Java
- Package Class in Java
- Process Class in Java
- ProcessBuilder Class in Java
- Runtime Class in Java
- Short Class in Java
- StackTraceElement Class in Java
- StrictMath Class in Java Set 1, Set 2
- String Class in Java Set 1, Set 2
- StringBuffer Class in Java
- StringBuilder Class in Java
- System Class in Java
- Thread Class in Java
- ThreadGroup Class in Java
- ThreadLocal
Class in Java - Throwable Class in Java
- Void Class in Java
Java Recent Articles!
Java Output & Multiple Choice Questions