🚀Day 4(Part 2)|Core Java learning journey ☕ Today I explored one of the most important basics of Java — Variables. Understanding variable types helps in writing clean, efficient, and bug-free code. 🔹 Local Variable Declared inside a method/block. Accessible only within that block. 🔹 Instance Variable Declared inside a class but outside methods. Each object gets its own copy. 🔹 Static Variable Declared using static keyword. Shared among all objects of the class. 🔹 Global Variable In Java, there is no direct concept of global variables. Class-level (static/instance) variables are used instead. 🔹 Constant Variable Declared using final keyword. Value cannot be changed once assigned. #CoreJava #JavaBasics #LearningJava #JavaDeveloper #FortuneCloud
Java Variables: Local, Instance, Static, Global, Constant
More Relevant Posts
-
Understanding Java Exception Hierarchy — Beyond Just Try-Catch While learning exception handling in Java, I realized that many beginners memorize exceptions without understanding their structure. Here is a simplified hierarchy: -> Object is the root class -> Throwable is the parent of all exceptions and errors # Two main branches: =>Errors -> Serious issues related to JVM -> Usually not handled in application code Example: VirtualMachineError, OutOfMemoryError =>Exceptions <>Checked Exceptions -> Checked at compile time -> Must be handled or declared using throws <>Unchecked Exceptions -> Occur at runtime -> Mostly due to programming mistakes Key learning: Understanding hierarchy makes it easier to decide: -> When to catch exceptions -> When to propagate them -> How Java differentiates compile-time vs runtime problems Special thanks to Prasoon Bidua sir for concept-based explanations. Open to feedback and better explanations. #Java #ExceptionHandling #CoreJava #BackendLearning #LearningInPublic
To view or add a comment, sign in
-
-
🚀 Day 18 | Java Arrays – Core Java Learning Today, I learned about Arrays in Java, a fundamental data structure used to store multiple values of the same data type efficiently. 🔹 What is an Array? An array is an object in Java that allows storing multiple values under a single variable name. 🔹 Key Points Covered: Arrays store elements of same data type. Types of arrays in Java: 1D Array 2D Array 3D Array Difference between: Regular Arrays (equal number of columns) Jagged Arrays (unequal number of columns) 🔹 Array Declaration Syntax: dataType[] arrayName; 🔹 Example: int[] a; 🔹 Accessing Elements: 1D: a[3] 2D: a[1][0] 3D: a[1][0][2] ✨ Arrays help in writing clean, structured, and efficient code and are widely used in real-world applications. #Day18 #Java #ArraysInJava #CoreJava #Programming #TapAcademy #LearningJourney #SoftwareDeveloper
To view or add a comment, sign in
-
-
** Java taught me how computers actually work ** Most people say: “I know Java” But real Java knowledge starts when you understand: How JVM loads classes Why Java is called hybrid (compiled + interpreted) Difference between == and .equals() How memory is managed (Stack vs Heap) Why immutability matters Java doesn’t just teach coding. It teaches problem-solving and design thinking. Still learning. Still improving. Excited for what’s ahead. #JavaDeveloper #JVM #OOP #InterviewPreparation #SoftwareDeveloper #LearningJava MD SADIQUE Sharath R Harshit T
To view or add a comment, sign in
-
📌 **Core Java – Strings Concept** Explored the fundamentals of Strings in Java including immutability, String Constant Pool (SCP), and the difference between Heap and SCP memory. Also practiced string comparison using `==`, `equals()`, and `equalsIgnoreCase()` along with important methods like `substring()`, `indexOf()`, and `split()`. Understanding how Java handles strings internally helps in writing efficient and optimized programs. TAP Academy Sharath R Harshit T #Java #CoreJava #Strings #LearningJourney #TAPAcademy #Programming
To view or add a comment, sign in
-
-
INSTANCE VARIABLE IN JAVA📌💫 📌Today I strengthened my Java basics by understanding Instance Variable in Java. 🔹An instance variable is a variable that is declared inside a class but outside all methods, constructors, and blocks. 🔹It is associated with an object (instance) of the class, which means each object gets its own separate copy of the instance variables. 📌 Key Characteristics ✨Declared without the static keyword. ✨Memoru is allocated when an object is created. ✨Each object maintains its own value. ✨Automatically initialized with default values. ✨Used to represent the state (properties) of an object. Accessing Instance Variables 🔹Accessed using object reference 🔹Can be accessed inside methods Instance Variables. 👉Memory Behavior 🔹Stored in heap memory 🔹Created when object is created using new 🔹Destroyed when object is eligible for garbage collection 💫Why Use Instance Variables? 🔹To store object-specific data 🔹To model real-world entities 🔹To maintain different states for different objects..... A big thanks to Anand Kumar Buddarapu sir for the support and encouragement throughout the learning journey 💥 Saketh Kallepu sir Uppugundla Sairam sir Support Team Codegnan #Java #OOPConcepts #StaticVariable #InstanceVariable #ProgrammingBasics #LearningJava #CodingJourney #SoftwareDevelopment
To view or add a comment, sign in
-
-
Understanding the First Two Types of Methods in Java In Java, methods help avoid writing all logic inside the main method by separating functionality into reusable blocks of code. Among them, the first two basic types are: 🔹 Methods with no input and no output These methods do not take any parameters and do not return any value. They are mainly used to perform actions such as displaying messages or executing fixed tasks. 🔹 Methods with no input but with output These methods do not accept parameters but return a value. The returned result can be stored or used by the calling method, making the code more reusable and structured. Using these methods keeps the program clean, readable, and aligned with good programming practices. Main method initiates execution; methods perform the work. 🚀 hashtag #Java #Methods #OOP #Programming #LearningJava #CleanCode #SoftwareDevelopment
To view or add a comment, sign in
-
-
Java Day 4 Happy Learning 😇! 🔎 **HashMap vs ConcurrentHashMap – Internal Working (Java)** Choosing the right Map implementation matters in concurrent systems. Let’s quickly break down **HashMap** and **ConcurrentHashMap**. 🟢 **HashMap** * Not thread-safe * Uses an internal `Node<K,V>[]` array * Bucket index is calculated using `hashCode()` * Handles collisions using a LinkedList * Since Java 8, converts to Red-Black Tree if bucket size > 8 * Average time complexity: O(1) ⚠ In multithreaded environments, it may cause data inconsistency. 🔵 **ConcurrentHashMap** * Thread-safe * Java 8+: Uses CAS + bucket-level synchronization * Allows multiple threads to write in different buckets * `get()` is non-blocking * Does not allow null keys or values 🔥 Key Difference: HashMap is ideal for single-threaded use. ConcurrentHashMap is built for high-concurrency systems. #Java #Concurrency #BackendDevelopment #SpringBoot
To view or add a comment, sign in
-
-
Java learning insights: Exception handling helps us manage errors in a program so it doesn’t stop suddenly. When an error happens without handling → program crashes ❌ With exception handling → program continues running ✅ Basic flow: • try → risky code • catch → handles the error • finally → always runs Simple example: try { int result = 10 / 0; } catch (ArithmeticException e) { System.out.println("Cannot divide by zero"); } Key takeaways: • Prevents program crash • Handles runtime errors smoothly • Improves code reliability • finally block always executes #Java #ExceptionHandling #JavaLearning #ProgrammingBasics
To view or add a comment, sign in
-
-
🚀 Learning Core Java – Stack & Heap Memory Explained While learning Core Java, I explored how Java manages memory using two important memory segments: Stack and Heap. The Stack memory follows the LIFO (Last In, First Out) principle. When a program starts, execution begins from the main() method, and a stack frame for the main method is created first. If the method contains local variables, memory for them is allocated inside the stack. All reference variables are also stored in stack memory. Whenever a method call occurs, a new stack frame is created and placed on top of the existing one. After the called method finishes execution, its stack frame is removed from the stack, freeing the allocated memory. On the other hand, objects are always created in the Heap memory. The stack only stores the reference to these objects. If an object exists in the heap without any reference pointing to it, it becomes a garbage object. To manage this, the JVM’s Garbage Collector automatically identifies and removes such unreferenced objects, helping optimize memory usage and improve application performance. Understanding stack and heap memory is essential for writing efficient, memory-safe Java applications. #CoreJava #JavaMemory #StackAndHeap #JavaInternals #GarbageCollection #ProgrammingFundamentals #JavaDeveloper #LearningJourney
To view or add a comment, sign in
-
-
📘 Understanding Pass by Value & Pass by Reference in Java 🚀 Today I learned and practiced one of the most important Java concepts — how data is passed and stored in memory. 🔹 Pass by Value Only the value of a variable is copied to another variable No connection exists after assignment Changing one variable does not affect the other Example insight: Assigning b = a copies the value Updating b later does not change a 🔹 Pass by Reference (Object Reference) Reference (address) of the object is passed Both variables point to the same object in heap memory Changes through one reference affect the other Key understanding: Objects are created in the Heap segment Reference variables are stored in the Stack Multiple reference variables can point to the same object 🔹 Memory Concept Primitive types → Pass by value Objects → Reference value is passed One object can have multiple reference names This practice helped me clearly understand Java memory allocation, object behavior, and how reference variables work internally 💡 Strong fundamentals make advanced concepts easier 💪 #Java #CoreJava #PassByValue #PassByReference #JavaMemory #OOPConcepts #LearningJourney #StudentDeveloper #Consistency TAP Academy
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development