Java TutorialLast Updated : 20 Sep, 2023ReadDiscuss(370+)CoursesThis Java programming tutorial is designed for beginners as well experienced professionals. Whether you’re looking to learn the basics of Java or its advanced concepts, our Java tutorial is the perfect resource for you.What is Java?Java is a most popular, object-oriented, widely used programming language and platform that is utilized for Android development, web development, artificial intelligence, cloud applications, and much more. So, mastering this gives you great opportunities in bigger organizations.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 WorldRecent Articles on JavaJava Programs – Basics to AdvancedJava Interview Questions Java OverviewJava BasicsJava Input/OutputJava Flow ControlJava OperatorsJava StringsJava ArraysJava OOPs ConceptsJava InheritanceJava AbstractionJava EncapsulationJava PolymorphismJava ConstructorsJava MethodsJava InterfacesJava Wrapper ClassesJava KeywordsJava Access ModifiersJava Memory Allocation Java ClassesJava PackagesJava Collection FrameworkJava ListJava QueueJava MapJava SetJava Exception HandlingJava MultithreadingJava SynchronizationJava File HandlingJava RegexJava IOJava NetworkingJava 8 FeaturesJava Date & TimeJDBCMiscellaneousJava Interview Questions Overview of JavaIntroduction to JavaHistory of JavaJava vs C++ PythonHow to Download and Install Java?Setting Up the Environment in JavaHow to Download and Install Eclipse on Windows?Java Development Kit (JDK) in JavaJVM and its architectureDifferences between JDK, JRE, and JVMJust In Time CompilerDifference Between JIT and JVMDifference Between Byte Code and Machine CodeHow is the Java platform independent?Basics of JavaJava Basic SyntaxFirst Java Program (Hello World)Datatypes in JavaDifference between Primitive and Non-Primitive DatatypesJava IdentifiersOperators in JavaJava VariablesScope of VariablesWrapper Classes in JavaInput/Output in JavaHow to take Input from users in JavaScanner class in JavaBufferedReader class in JavaScanner vs BufferedReader in JavaWays to Read Input from Console in JavaPrint Output in JavaDifference between print() and println() in JavaFormatted Outputs in JavaFast Input-Output for Competitive Programming in JavaFlow Control in JavaDecision making in JavaIf Statement in JavaIf-Else Statement in javaIf-Else-If ladder in JavaLoops in JavaFor loopWhile LoopDo while loopFor each loopContinue Statement in javaBreak Statement In JavaUsage of Break in JavaReturn Statement in JavaOperators in JavaArithmetic OperatorUnary OperatorAssignment OperatorRelational OperatorLogical OperatorTernary OperatorBitwise OperatorStrings in JavaIntroduction of Strings in JavaString class in Java Set-1 | Set-2Why strings are immutable in Java?StringBuffer class in JavaStringBuilder class in JavaStrings vs StringBuffer vs StringBuilder in JavaStringTokenizer class in Java Set-1 | Set-2StringJoiner in JavaJava String ProgramsArrays in JavaIntroduction to Arrays in JavaArrays class in JavaMulti-Dimensional Array in JavaHow to declare and initialize 2D arrays in JavaJagged array in JavaFinal Arrays in JavaReflect Arrays in JavaDifference between util.Arrays and reflect.ArraysJava Array ProgramsOOPS in JavaOOPS Concept in JavaWhy Java is not a purely Object-Oriented Language?Classes and ObjectsNaming Convention in JavaMethods in JavaAccess Modifiers in JavaConstructors in JavaFour pillars of OOPS in JavaInheritance in JavaAbstraction in JavaEncapsulation in JavaPolymorphism in JavaInterfaces in JavaThis reference in JavaInheritance in JavaIntroduction to Inheritance in JavaInheritance and ConstructorsMultiple Inheritance in JavaInterfaces and InheritanceAssociation, Composition and AggregationDifference between Inheritance in C++ and JavaAbstraction in JavaIntroduction to Abstraction in JavaAbstract Keyword in JavaAbstract classes in JavaAbstract class vs Interface in JavaControl Abstraction in JavaDifference between Data Hiding and AbstractionEncapsulation in JavaIntroduction to Encapsulation in JavaDifference between Encapsulation and AbstractionPolymorphism in JavaIntroduction to Polymorphism in JavaDifference between Inheritance and PolymorphismRuntime Polymorphism in JavaCompile-Time vs Runtime PolymorphismConstructors in JavaIntroduction to Constructors in JavaCopy Constructor in JavaConstructor OverloadingConstructor ChainingPrivate Constructors and Singleton ClassMethods in JavaIntroduction to methods in JavaDifferent method calls in JavaDifference between Static methods and Instance methods in JavaAbstract methods in JavaMethod Overriding in JavaMethod Overloading in JavaMethod Overloading Vs Method OverridingInterfaces in JavaJava InterfacesInterfaces and Inheritance in JavaDifference between Interface and Class in JavaFunctional InterfaceNested InterfaceMarker InterfaceComparator InterfaceWrapper Classes in JavaNeed of Wrapper classes in JavaHow to create instances of Wrapper classesCharacter class in JavaByte class in JavaShort class in JavaInteger class in JavaLong class in JavaFloat class in JavaDouble class in JavaBoolean class in JavaAutoboxing and UnboxingType Conversion in JavaKeywords in JavaList of all Java KeywordsImportant Keywords in JavaSuper KeywordFinal KeywordAbstract keywordStatic KeywordThis KeywordEnum Keyword in JavaTransient keyword in javaVolatile keyword in javaFinal, Finally, and Finalize in JavaAccess Modifiers in JavaIntroduction to Access Modifiers in JavaPublic vs Protected vs Package vs Private Access Modifier in JavaAccess Modifiers Vs Non-Access Modifiers in JavaMemory Allocation in JavaJava Memory ManagementHow are Java objects stored in memoryStack vs Heap memory allocationTypes of memory areas allocated by JVMGarbage Collection in JavaHeap and Stack memory allocationTypes of JVM Garbage Collectors in JavaMemory leaks in JavaJava Virtual Machine(JVM) Stack AreaClasses of JavaClasses and ObjectsUnderstanding classes and objects in JavaClass vs interfaceSingleton class in javaObject class in javaInner class in javaAbstract classes in javaThrowable class in javaPackages in JavaJava PackagesHow to create a package in Javajava.util packagejava.lang packagejava.io packageCollection Framework in JavaJava Collection FrameworkCollections class in JavaCollection Interface in JavaHow to learn Java collectionsList Interface in JavaQueue Interface in JavaMap Interface in JavaSet in JavaIterator in JavaComparator in JavaDifference between Comparator and Comparable in JavaList in JavaArrayList in JavaVector class in JavaStack class in JavaLinkedList in JavaAbstractListAbstractSequentialListCopyOnWriteArrayListCustom ArrayList in JavaQueue in JavaAbstractQueueArrayBlockingQueueConcurrentLinkedQueueLinkedBlockingQueueLinkedTransferQueuePriorityBlockingQueueDeque in JavaArrayDequeConcurrent LinkedDequeLinkedBlocking DequePriority Queue in JavaMap in JavaEnumMapHashMapWorking of HashMapTraverse through a HashMap in JavaWeakHashMapLinkedHashMapIdentityHashMapConcurrentHashMapDictionaryHashTableSortedMapTreeMapStackVectorSet in JavaAbstractSetEnumSetHashSetTreeSetSortedSetLinkedHashSetNavigableSetConcurrentSkipListSetCopyOnWriteArraySetException Handling in JavaExceptions in javaTypes of ExceptionsDifference between Checked and Unchecked ExceptionsTry, Catch, Finally, throw, and throwsFlow control in Try catch blockThrow vs ThrowsFinal vs Finally vs FinalizeUser-defined custom exceptionChained ExceptionsNull pointer ExceptionsException handling with method OverridingMultithreading in JavaIntroduction to Multithreading in JavaLifecycle and Stages of a ThreadThread Priority in JavaMain Thread in JavaThread classRunnable interfaceHow to name a threadstart() method in threadDifference between run() and start() Methodsleep() methodDaemon threadThread Pool in JavaThread Group in JavaThread Safety in JavaShutdownHookMultithreading TutorialSynchronization in JavaJava SynchronizationImportance of Thread synchronization in JavaMethod and Block Synchronization in JavaLocal frameworks vs thread synchronizationDifference between Atomic, Volatile, and Synchronized in JavaDeadlock in MultithreadingDeadlock Prevention and AvoidanceDifference between Lock and Monitor in ConcurrencyReentrant LockFile Handling in JavaFile Class in javaHow to create files in javaHow to read files in javaHow to write on files in javaHow to delete a file in javaFile PermissionsFileReaderFile WriterFileDescriptor classRandomAccessFile classJava RegexIntroduction to Java RegexHow to write Regex expressionsMatcher classPattern classQuantifiersCharacter classJava IOIntroduction to Java IOReader ClassWriter ClassFileInput streamFile Output streamBufferedReader Input StreamBufferedReader Output streamBufferedReader vs ScannerFast I/O in JavaJava NetworkingIntroduction to Java NetworkingTCP architectureUDP architectureIPV4 vs IPV6Connection-oriented vs connectionless protocolsSocket programming in JavaServer Socket classURL class and methodsJava SE 8 FeaturesLambda ExpressionsStreams APINew Date/Time APIDefault MethodsFunctional InterfacesMethod referencesOptional classStream FilterType AnnotationsString JoinerJava Date & TimeDate Class in JavaMethods of the Date classJava Current Date and timeCompare dates in JavaJava JDBCIntroduction to Java JDBCJDBC DriverJDBC ConnectionTypes of Statements in JDBCJDBC TutorialJava MiscellaneousIntroduction to Reflection APIJava IO TutorialJavaFX TutorialJava RMIHow to Run Java RMI application?Java 17 New FeaturesInterview Questions on JavaCore Java Interview QuestionsJava Multiple Choice QuestionsFeatures of JavaJava is one of the most popular and widely used programming languages.Java has been one of the most popular programming languages 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 kinds 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 to 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 are 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.Applications of JavaMobile ApplicationsDesktop GUI ApplicationsArtificial intelligenceScientific ApplicationsCloud ApplicationsEmbedded SystemsGaming ApplicationsFrequently Asked Questions on JavaQ.1 Why use Java ?-Java is simple to learn programming language because doesn’t contain concepts like : Pointers and operator overloading and it is secure and portable.Q.2 How Java different to C++ ?C++JAVAC++ is platform dependent.Java is platform independent.C++ uses compiler only.Java uses compiler and interpreter both.C++ support pointers and operator overloading.Java doesn’t support pointers and operator overloading concept.C++ not support multithreading concept.Java supports multithreading concept.