🚀 Day 24 at Tap Academy – Mutable Strings in Java Today’s learning was about Mutable Strings in Java and how they differ from normal String objects. 🔹 In Java, String objects are immutable – once created, they cannot be changed. To overcome this limitation, Java provides mutable string classes: ✅ StringBuffer Mutable class Thread-safe (synchronized) Slower compared to StringBuilder Used in multi-threaded environments ✅ StringBuilder Mutable class Not thread-safe Faster than StringBuffer Preferred in single-threaded applications ✅ StringTokenizer Used to break a string into tokens Helpful for parsing data Works based on delimiters (like space, comma, etc.) 💡 Key Takeaway: Understanding the difference between String, StringBuffer, and StringBuilder helps in writing efficient and optimized Java programs. Every day I’m learning something new and strengthening my core Java concepts 💻🔥 #Java #Programming #TapAcademy #CodingJourney #Learning
Java Mutable Strings: StringBuffer vs StringBuilder
More Relevant Posts
-
Day 9 – Java Learning Journey Today I continued strengthening my Java fundamentals, focusing on method overriding and important rules in inheritance. Key concepts I explored: • Method Overriding Rules in Java The child class method must have the same method signature as the parent class method. The return type must be the same or covariant (a subclass of the parent return type). The method cannot be static, because static methods belong to the class rather than the object. • Covariant Return Types Java allows a child class method to return a more specific type than the parent class method, making inheritance more flexible. • Static vs Instance Methods I also learned why static methods cannot be overridden and are instead method hidden, which behaves differently from runtime polymorphism. Step by step, continuing to build a stronger foundation in Core Java and OOP concepts. 🚀 #Java #CoreJava #OOP #MethodOverriding #Programming #SoftwareDevelopment #LearningJourney
To view or add a comment, sign in
-
🚀 Learning Java – Understanding the Static Keyword Today I completed the "Static" concept in Java on TAP Academy. In Java, the keyword static is used for variables, methods, blocks, and nested classes. It means the member belongs to the class, not to individual objects. 1️⃣ Static Variable (Class Variable) A variable declared with static is shared by all objects of the class. Only one copy exists in memory. 2️⃣ Static Method A method declared as static can be called without creating an object. It can only directly access static variables and static methods. 3️⃣ Static Block Used for initializing static variables. It runs only once when the class is loaded. 4️⃣ Static Nested Class A class declared inside another class with static. It can access only static members of the outer class. #Java #Programming #Learning #TAPAcademy #SoftwareDevelopment #BTechStudent
To view or add a comment, sign in
-
-
💻 Understanding the Object Class and toString() Method in Java Day 31 at #TAPACADEMY As part of my journey in learning Java and Object-Oriented Programming, I explored the Object class, which is the root of the entire Java class hierarchy. 🔹 Object Class in Java The Object class is the parent class of all classes in Java. Every class automatically inherits methods from it, either directly or indirectly. Some commonly used methods provided by the Object class include: ✔ equals() – Used to compare two objects ✔ hashCode() – Generates a unique hash value for objects ✔ clone() – Creates a copy of an object ✔ toString() – Returns the string representation of an object 🔹 toString() Method The toString() method is used to convert an object into a readable string representation. By default, it returns the class name and hash code, but it can be overridden to display meaningful information about an object. Overriding this method helps improve readability, debugging, and logging in Java applications. 📚 Understanding the Object class gives deeper insight into how Java manages objects and inheritance, making it a fundamental concept in mastering Java programming. Trainer : Sharath R #Java #ObjectOrientedProgramming #OOP #JavaDeveloper #Programming #LearningJourney #SoftwareDevelopment
To view or add a comment, sign in
-
-
🚀 Day – Java Learning Update ⏳ 🎯 Understanding Switch Case in Java Today, I learned about the Switch Case statement in Java, which is used to execute different blocks of code based on the value of a variable or expression. It is mainly used when we have multiple conditions to check for a single variable, making the code more readable compared to many if-else statements. 🔹 What is Switch Case? The switch statement allows a variable to be tested against multiple possible values called cases. ✔ Each case represents a possible value ✔ break stops execution after a case runs ✔ default runs if no case matches 🔹 Syntax of Switch Case switch(expression) { case value1: // code block break; case value2: // code block break; case value3: // code block break; default: // default code block } 🧑💻 Task Practiced: Traffic Signal Program I implemented a simple program using switch case to represent a traffic signal. #Java #CoreJava #JavaFullStack #SwitchCase #Programming #SoftwareDeveloper #LearningJourney 10000 Coders Meghana M
To view or add a comment, sign in
-
-
🔥 Day 25 – Method Overloading in Java Today’s learning was all about Method Overloading. 📌 What is Method Overloading? Method Overloading is the process of creating multiple methods with the same name inside a class but with different parameters. ✅ Methods can be overloaded by: 1️⃣ Changing the number of parameters 2️⃣ Changing the data type of parameters 3️⃣ Changing the order (sequence) of parameters ⚠️ Important Note: Changing only the return type does NOT support method overloading — it will cause a compilation error. 💡 Method Overloading & Type Promotion We also learned how type promotion works during method overloading. Smaller data types can automatically convert into larger data types: byte → short → int → long → float → double This plays an important role when the exact method match is not found — Java promotes the data type and selects the best suitable method. 🎯 Key Takeaways: ✔️ Also known as Compile-Time Polymorphism ✔️ Improves code readability and flexibility ✔️ Achieved through Static Binding (Early Binding) ✔️ Helps perform similar operations with different inputs Looking forward to learning more advanced concepts! 🚀 #Day25 #Java #MethodOverloading #JavaDeveloper #LearningJourney #Coding #Programming #TapAcademy
To view or add a comment, sign in
-
-
🚀 Starting My Java Learning Journey – Day 8 🔹 Topic: Methods in Java A method is a block of code that performs a specific task. Methods help make programs organized, reusable, and easier to read. returnType – type of value the method returns (use void if it returns nothing) methodName – name of the method parameters – input values the method takes 📌 Example Program public class Main { // Method to add two numbers static int addNumbers(int a, int b) { return a + b; } public static void main(String[] args) { int sum = addNumbers(10, 20); System.out.println("Sum: " + sum); } } Output: Sum: 30 💡 Key Points: Methods avoid code repetition Methods can take inputs (parameters) and return outputs Helps in modular programming #Java #JavaLearning #Programming #BackendDevelopment #CodingJourney #JavaMethods
To view or add a comment, sign in
-
💻 Exploring Method Overriding & the final Keyword in Java Day 30 at #TapAcademy Continuing my journey in Object-Oriented Programming (OOP) with Java, I explored two important concepts: Method Overriding and the final keyword. 🔹 Method Overriding Method overriding occurs when a child class provides its own implementation of a method that is already defined in the parent class. It enables runtime polymorphism, allowing methods to behave differently based on the object that calls them. 📌 Key Rules of Method Overriding: ✔ The method name must be the same as in the parent class ✔ The parameter list must remain the same ✔ The return type must be the same or covariant ✔ The access modifier cannot be more restrictive than the parent method ✔ Static, private, and final methods cannot be overridden 🔹 final Keyword in Java The final keyword is used to restrict modification in Java programs. 📌 It can be used in three ways: • Final Variable – The value cannot be changed once assigned • Final Method – The method cannot be overridden in a child class • Final Class – The class cannot be inherited Understanding these concepts helps in controlling inheritance, protecting code from unwanted changes, and implementing runtime polymorphism effectively. 📚 Always excited to deepen my knowledge in Java and OOP concepts as I continue learning and building! Trainer: Sharath R #Java #OOP #MethodOverriding #FinalKeyword #Programming #SoftwareDevelopment #LearningJourney
To view or add a comment, sign in
-
-
🚀 Day 13 of My Java Learning Journey at Tapp Academy Today’s topic: Immutable & Mutable Strings in Java By default, Strings in Java are immutable. To work with mutable strings, Java provides two important classes: 🔹 StringBuffer 🔹 StringBuilder Here’s what I learned today 👇 🔸 StringBuffer • It is a class, so we must create an object. • Default capacity → 16 characters • Capacity growth formula → (currentCapacity × 2) + 2 • append() → Used to add content • length() → Returns the actual number of characters • trimToSize() → Adjusts capacity to match the actual length • delete(start, end) → Removes characters between given indexes • It is synchronized (thread-safe) Example: If the string contains 50 characters, the capacity might show 70. Using trimToSize() makes both length and capacity equal. 🔸 StringBuilder • Almost 90% similar to StringBuffer • Not synchronized • Faster compared to StringBuffer 📌 Key Difference: StringBuffer is thread-safe, while StringBuilder is not. Understanding these concepts helped me learn how Java manages memory, performance, and string manipulation efficiently. Learning step by step. Improving every day. 💻✨ Excited for Day 14! #Java #JavaProgramming #JavaDeveloper #StringBuffer #StringBuilder #ImmutableString #MutableString #CodingJourney #SoftwareDevelopment #WomenInTech #LearningEveryday #DeveloperJourney #100DaysOfCode #TechCareer #JavaLearning #ProgrammingLife
To view or add a comment, sign in
-
-
🌱 Learning the Basics of OOP in Java While learning Java, I understood that Object-Oriented Programming (OOP) is built on 4 simple but powerful concepts: 🔹 1. Inheritance One class can use properties and methods of another class. 👉 This helps in reusing code. 🔹 2. Encapsulation Keeping data safe by wrapping variables and methods inside a class. 👉 We use private variables and getters/setters for security. 🔹 3. Polymorphism One method can behave differently in different situations. 👉 Example: Method overloading and method overriding. 🔹 4. Abstraction Showing only important details and hiding internal implementation. 👉 Done using abstract classes and interfaces. Understanding these concepts makes Java much clearer and helps in building real-world applications. I’m currently improving my Java fundamentals step by step. Every small concept I learn gives me more confidence. 💪 #Java #OOP #ProgrammingBasics #LearningJava #BeginnerDeveloper #SoftwareDevelopment
To view or add a comment, sign in
-
-
Today, I strengthened my understanding of Method Overloading in Java — an important concept of compile-time polymorphism. 🔹 Key Rules I Learned: ✔ Method name must be the same ✔ The number of parameters can be different ✔ The data type of parameters can be different ✔ The order of parameters can be different ✔ Changing only the return type does NOT support overloading 🔹 Understanding Type Promotion Java follows this order during method resolution: byte → short → int → long → float → double Java first looks for an exact match. If not found, it promotes the smaller data type to the next higher type. Practicing these fundamentals is helping me build a strong base in Core Java and improve my problem-solving skills step by step. TAP Academy #Java #CoreJava #MethodOverloading #Programming #JavaDeveloper #LearningJourney
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