Java TutorialIntroductionEnvironment SetupIDEBuild ManagementLanguage SpecificationBasic ProgramVariables Data TypesPackagesModifiersConditionalsLoopsObject OrientedClassesSuperInterfacesEnumStatic importInheritanceAbstractionEncapsulationPolymorphismBoxing & UnboxingConversion Formatting numbers Arrays Command line arguments in java Variable Number of arguments in Java Exception handling in Java String handling in Java StringBuffer and StringBuilder in Java Mathematical Operations in Java Date and Time in Java Regular expressions in Java Input output programming in Java File Handling Nested Classes Collections Generics Serialization Socket programming Multi-Threading Annotations Lambda Expressions Reflections in Java Singleton class in Java Runtime Class in JavaHow to load resource in JavaHow to load properties file in Java
AdvancedLog4j – Logging framework in JavaInterview Questions in Java
In Java, there are 3 types of variables.
- Instance Class variables
- Static Class variables
Local variables are declared in methods of class. We can’t use modifiers like public/private with local variables.
Instance Class variables are declared at class level outside of all methods of class. We can use modifiers like public/private with instance variables. We need to create the objects of the class to access instance variables. Each object gets it’s own copy of instance variable in heap.
Static Class variables are declared at class level outside of all methods of class. We can use modifiers like public/private with instance variables. We can directly access static class variables using Class name. We do not need object of the class to access static variable. All objects share the same static variable.
Web development and Automation testing