Day 19..... 💡 Today’s Java Learning Journey 🚀 Hey LinkedIn folks! 👋 Today I explored two important Java concepts: the main() method and Strings. 🧠 Why String[] args in main()? It is used to receive command-line arguments. Any data passed while running a Java program is captured as strings. These values are stored inside the args array and can be accessed during execution. 🔤 Strings in Java A String is a sequence of characters enclosed in double quotes. Strings in Java are objects, not primitive data types. 📌 Types of Strings in Java ✅ Immutable Strings Cannot be changed once created Represented by the String class Best suited for fixed data like Name, Gender, Date of Birth ✅ Mutable Strings Can be modified after creation Represented by StringBuffer and StringBuilder classes Useful for editable data like Passwords, Messages, Email IDs 🧰 Commonly Used String Methods length() equals() equalsIgnoreCase() compareTo() concat() substring() replace() toUpperCase() trim() split() contains() indexOf() ✨ Java Strings may look simple, but they are powerful behind the scenes. Understanding how they work helps write efficient and memory-optimized code 💪 #Java #LearningJourney #Coding #FullStack #Mutable #Immutable #JavaDeveloper
Java Main Method and Strings Explained
More Relevant Posts
-
Day 23...... 🚀 Today’s Java Learning: Strings & Their Superpowers Hey LinkedIn fam 👋 Today I explored one of the most important concepts in Java — Strings. Here’s a quick and clear recap of what I learned 👇 💡 What is a String? A String is a sequence of characters enclosed in " " and it is an object in Java. 🔹 Types of Strings in Java ✅ Immutable Strings (String) • Cannot be changed once created • Used for fixed data like Name, Gender, DOB ✅ Mutable Strings (StringBuffer, StringBuilder) • Can be modified • Used for editable data like Passwords, Messages, Email IDs ⚔️ String Comparison Methods • equals() – Compares content • equalsIgnoreCase() – Ignores case • compareTo() – Lexicographical comparison ➕ String Concatenation • Using + → Stored in String Constant Pool (literals) • Using concat() → Creates a new object in Heap memory 🧩 Commonly Used String Methods toUpperCase() toLowerCase() length() charAt() contains() startsWith() endsWith() indexOf() lastIndexOf() replace() isEmpty() isBlank() split() toCharArray() 🛠️ Mutable Strings – Quick Comparison • StringBuffer → Thread-safe, slower • StringBuilder → Not thread-safe, faster 💡 Key Takeaway: Understanding Strings (memory, mutability, and methods) helps write cleaner, faster, and more efficient Java code 💪 #Java #StringHandling #LearningJourney #CodingInJava #FullStackDeveloper #DailyLearning
To view or add a comment, sign in
-
-
Day 13 – Exploring Strings in Java | My Learning Journey Today I continued my journey of learning Java and explored more concepts related to Strings. Strings are one of the most commonly used data types in programming because they help us work with text data effectively. 🔹 1. String Concatenation in Java String concatenation means combining two or more strings into a single string. In Java, this is commonly done using the + operator or the concat() method. Example: String firstName = "Hello"; String secondName = "World"; System.out.println(firstName + " " + secondName); Output: Hello World 🔹 2. Built-in Methods in String Java provides many built-in methods in the String class that help us perform operations easily. Some commonly used methods include: length() – Returns the length of a string charAt() – Returns the character at a specific index toUpperCase() – Converts string to uppercase toLowerCase() – Converts string to lowercase contains() – Checks if a string contains a specific value substring() – Extracts part of a string Example: String text = "Java Programming"; System.out.println(text.toUpperCase()); 🔹 3. StringTokenizer StringTokenizer is used to split a string into multiple tokens based on a delimiter like space, comma, or any other character. Example: import java.util.StringTokenizer; String str = "Welcome to Java"; StringTokenizer st = new StringTokenizer(str); while(st.hasMoreTokens()){ System.out.println(st.nextToken()); } Output: Welcome to Java Understanding string concatenation, built-in string methods, and String Tokenizer helps in handling and manipulating text data efficiently in Java applications. 💡 Every day I’m learning something new and improving my programming skills step by step. #Java #LearningJava #JavaProgramming #CodingJourney #Strings #DaysOfCode #DeveloperJourney
To view or add a comment, sign in
-
-
DAY 16: CORE JAVA TAP Academy 🚀 Deep Dive into Java Strings: Memory, Methods, and Manipulation If you're learning Java, you quickly realize that Strings aren't just simple data types—they are objects with unique memory management rules! I’ve been brushing up on the fundamentals and mapped out some key concepts. Here’s a breakdown of what I’ve been diving into: 🧠 1. String Memory Management The difference between SCP (String Constant Pool) and the Heap is crucial for performance: * Direct Literals: Using "A" + "B" creates the string in the SCP. No duplicates allowed! * Variables/Objects: Concatenating variables (e.g., s1 + s2) or using the concat() method always creates a new object in the Heap. * The Result: Two strings can have the same value but different memory references. This is why we use .equals() for content and == for reference! 🛠️ 2. Essential String Methods Java provides a robust toolkit for string manipulation. Some of my favorites from today’s practice: * substring(start, end): To extract specific parts of a string. * indexOf() & lastIndexOf(): To track down character positions. * toCharArray() & split(): Perfect for breaking strings down for complex algorithms. ⚖️ 3. Mastering compareTo() Unlike .equals() which just gives a True/False, compareTo() returns an integer based on Lexicographical order: * Negative: s1 < s2 (comes before) * Positive: s1 > s2 (comes after) * Zero: They are a perfect match! Understanding these nuances is the first step toward writing memory-efficient Java code. #Java #Programming #CodingTips #SoftwareDevelopment #LearningToCode #TechCommunity #JavaStrings
To view or add a comment, sign in
-
-
Day 5 of learning Java 🚀 Understanding Variables in Java (Simple Explanation) Today I learned about Variables. A variable is like a container that stores data. For example: If we want to store age, name, or marks — we use variables. 🔹 How to Create a Variable? In Java, we write: Copy code dataType variableName = value; Example: Java Copy code int age = 21; String name = "Ishu"; double marks = 85.5; Here: int, String, double → Data types age, name, marks → Variable names 21, "Ishu", 85.5 → Values 🔹 Variable Naming Rules (Very Important) ✅ A variable name must start with a letter, _, or $ ✅ It cannot start with a number ✅ It should not use Java keywords (like int, class, public) ✅ Variable names are case-sensitive ✔️ Correct: Java Copy code int age; String firstName; ❌ Wrong: Java Copy code int 1age; int class; 👉 In simple words: A variable stores data, and its name should follow proper rules. Building strong basics step by step 💻✨ #Day5 #JavaLearning #Variables #ProgrammingBasics #BeginnerFriendly #LearningInPublic
To view or add a comment, sign in
-
-
🚀 Day 12 – Core Java TAP Academy | Variables (Instance vs Local) 💻🔥 Today’s Core Java session was a super important foundation topic: VARIABLES ✅ Not just “variables store data” — we went deeper into how Java stores them in memory and what happens inside RAM while executing a program 🧠⚙️ 📌 What is a Variable? A variable is like a container that stores data 🧺 In Java, variables help us store values, access them, and manipulate them during program execution. 🔥 Types of Variables Covered Today 1️⃣ Instance Variables (Class Level) 🏛️ ✅ Declared directly inside a class ✅ Memory allocated in Heap (inside Object) 🧱 ✅ Java automatically assigns Default Values 🎯 📌 Default values examples: int → 0 float → 0.0f boolean → false char → empty character ('\u0000') (not space ❗) 2️⃣ Local Variables (Method Level) 🧩 ✅ Declared inside a method (like main) ✅ Memory allocated in Stack 📚 ❌ Java will NOT assign default values ⚠️ If you try to print without initializing → Compilation Error ❌ 👉 So we must initialize local variables manually before using them ✅ 🧠 Key Takeaway Understanding variables with memory layout (Stack vs Heap) is a game-changer 💡 It helps us debug better, write clean code, and think like a real developer — not just copy-paste from AI 🤖➡️👨💻 ✅ Consistent Learning + Daily LinkedIn Posting = Growth 📈✨ On to the next day with more Java concepts! 🚀🔥 Trainer:Sharath R #CoreJava #Java #TapAcademy #Variables #InstanceVariable #LocalVariable #JVM #Stack #Heap #Programming #JavaDeveloper #LearningJourney #TechSkills #PlacementPreparation #InterviewPrep #DailyLearning 🚀💻
To view or add a comment, sign in
-
-
Day16----Learning Java 🚀 Today I revised Relational & Logical Operators in Java Understanding operators is a small step that makes a big difference in writing conditions and decision-making logic. 🔹 Relational Operators Used to compare two values and return a boolean result (true / false): > Greater than < Less than >= Greater than or equal to <= Less than or equal to == Equal to != Not equal to Example: int age = 17; System.out.println(age >= 18); // false System.out.println(age != 18); // true 🔹 Logical Operators Used to combine multiple conditions: && (AND) → true if all conditions are true || (OR) → true if any one condition is true ! (NOT) → reverses the result Example: int marks = 75; System.out.println(marks > 60 && marks < 90); // true 📌 These operators are widely used in: if-else statements loops validations real-world decision logic ✨ Strengthening basics like this helps build strong programming fundamentals. #Java #ProgrammingBasics #RelationalOperators #LogicalOperators #LearningJava #CodingJourney Meghana M
To view or add a comment, sign in
-
Day 21: Strings in Java Today’s learning was all about understanding how Strings work internally in Java from creation to comparison and concatenation. 🔹 What is a String? A String is a sequence of characters enclosed in double quotes (" " ), whereas a character uses single quotes (' ' ). ➡️ Multiple characters cannot be stored in single quotes. 🔹 Types of Strings Strings are classified into two types: Mutable Strings – values can be changed Immutable Strings – values cannot be changed (default in Java) 🔹 Ways to Create a String in Java Using new keyword Using string literals Using character arrays 🔹 String Comparison Methods Java provides multiple ways to compare strings: == → compares reference (memory address) equals() → compares values/content equalsIgnoreCase() → compares values ignoring case compareTo() → compares character by character (lexicographically) 🔹 Where Are Strings Stored in Memory? Strings are stored in the Heap Segment of the JRE Heap is divided into: Constant Pool – no duplicates allowed Non-Constant Pool – duplicates allowed 🔹 String Pool Concept Strings created without new keyword → Constant Pool Strings created using new keyword → Non-Constant Pool 🔹 String Concatenation String concatenation means combining multiple strings to form a new string. Can be done using: + operator concat() method 📌 Understanding Strings is crucial for memory management and performance in Java. #Day21 #Java #StringsInJava #CoreJava #Programming #LearningJourney #TapAcademy #JavaDeveloper
To view or add a comment, sign in
-
-
🚀 Day A9 at Tap Academy – Understanding Variables in Java ☕ Today’s session was all about one of the most fundamental concepts in Java – Variables. Mastering variables is the first step toward building powerful Java programs. Let’s break it down in a simple way 👇 📦 What is a Variable? A variable is like a container used to store data in memory. Each variable must belong to a specific data type, which defines what kind of data it can store. Syntax: dataType variableName; Example: int a; 🔹 Types of Variables in Java 1️⃣ Instance Variables Declared inside the class but outside methods Memory allocated in the Heap segment Automatically get default values from JVM Accessible throughout the entire class Example: Java class Student { int id; // instance variable } 2️⃣ Local Variables Declared inside methods or blocks Memory allocated in the Stack segment ❌ Do NOT get default values from JVM Must be initialized by programmer Accessible only within the method/block Example: Java void display() { int marks = 90; // local variable } 🧠 JRE Memory Structure (Runtime Memory Segments) JRE (Java Runtime Environment) allocates memory in RAM using four segments: 📄 Code Segment – Stores compiled bytecode 📌 Static Segment – Stores static variables 🧺 Heap Segment – Stores instance variables & objects 📚 Stack Segment – Stores local variables & method calls 🎯 Default Values of Instance Variables Data Type. Default Value int. 0 float/double. 0.0 char. empty (\u0000) boolean. false String / Array / Object. null ⚠️ Local variables do NOT get default values. ⚖️ Difference Between Instance and Local Variables 👉Feature. Instance Variable. Local Variable 👉Declared. Inside class. Inside method 👉Memory. Heap. Stack 👉Default Value Provided by Jvm Not provided 👉Scope. Entire class. Only method/block 👉Access. through objects. Only within method 💡 Key Takeaway Variables are the foundation of Java programming. Understanding their types, memory allocation, scope, and default values helps in writing efficient and error-free programs. ✨ Every line of code becomes meaningful when you understand where and how data is stored. #TapAcademy #Java #Variables #JVM #JRE #Programming #JavaDeveloper #CodingJourney #LearnJava #SoftwareDevelopment #CoreJava
To view or add a comment, sign in
-
-
🚀 Day 8 | Core Java Learning Journey 📌 Topic: String in Java Today, I learned about Strings in Core Java, one of the most frequently used and important concepts for handling textual data in Java applications. 🔹 What is a String ? A String is a sequence of characters. In Java, Strings are objects used to store and manipulate text efficiently. 🔹 Declaration of String There are two ways to create a String in Java: 1️⃣ Using String Literal String name = "Ketan"; 2️⃣ Using new Keyword String name = new String("Ketan"); 🔹 Important String Classes Provided by Java Java provides several built-in classes for handling strings: 1️⃣ java.lang.String 2️⃣ java.lang.StringBuffer 3️⃣ java.lang.StringBuilder 4️⃣ java.util.StringTokenizer 🔹 What is SCP (String Constant Pool)? The String Constant Pool is a special memory area inside the heap that stores String literals to optimize memory usage and improve performance. 🔹 Properties of SCP ✅ Stores only String literals ✅ Prevents duplicate String objects ✅ Improves memory utilization ✅ Enhances application performance 🔹 String Memory Allocation in Java Strings created using the new keyword create a new object in the Heap area, while their literals exist in the String Constant Pool (SCP). Strings created without the new keyword are stored only in the SCP, and if the value already exists, Java reuses the same reference instead of creating a new object, which improves memory efficiency. 🔹 Interview Insight (Java Strings) ✔️ Every predefined class in Java inherits from the Object class. ✔️ The String class is final to prevent inheritance and ensure security. ✔️ String objects are immutable, which helps in performance optimization, caching, and thread safety. 📌 Key Learning: A strong understanding of Strings, SCP, and immutability helps in writing secure, efficient, and optimized Java applications. A special thanks to Vaibhav Barde Sir for his consistent guidance and clear explanations. 🙏 Looking forward to learning more Core Java concepts ahead! 💻✨ #CoreJava #JavaStrings #JavaDeveloper #BackendEngineering #SoftwareDeveloper #ComputerScienceGraduate #ProgrammingLife #TechLearning #JavaConcepts #LearningJourney
To view or add a comment, sign in
-
-
Day 2 – Learning Java Full Stack Java may look simple on the surface, but today I learned what actually happens behind the scenes when a Java program runs. Here’s a clear breakdown of my learning 👇 🔹 Execution of a Java Program A Java program follows a two-step process: 1️⃣ Compilation 2️⃣ Interpretation (Execution) 🔹 Step 1: Compilation Java source code must be saved with a .java extension The javac compiler checks for syntax errors If a syntax error exists → compile-time error (bytecode is NOT generated) If no errors → bytecode (.class file) is generated Important: Without successful compilation, execution never happens. 🔹 Step 2: JVM Verification & Execution Once bytecode is generated, JVM performs multiple checks: ✔️ Confirms bytecode is generated by javac ✔️ Verifies bytecode is not modified ✔️ Checks for logical errors during execution If all checks pass → ➡️ JVM converts bytecode into machine code and executes it. If a logical error occurs → ➡️ Exception is raised, and execution stops immediately. 🔹 Understanding Exceptions with Examples Division by zero → ArithmeticException When an exception occurs: Statements before the error execute Statements after the error do NOT execute 🔹 Key Commands I Practiced javac Demo.java → compilation java Demo → execution And revisited the basic structure: Class declaration main() method → entry point of execution Key takeaway: Java doesn’t blindly execute code. It verifies, validates, and protects execution through compiler checks, JVM verification, and exception handling. Sharing my learning as I go — hoping this helps someone understand Java execution more clearly 🙌 More insights coming soon. #Java #JavaFullStack #JVM #ExceptionHandling #LearningInPublic #BackendDevelopment #ProgrammingBasics
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