Day 10/100 — Scanner User Input in Java ⌨️ One common issue every Java beginner faces while taking user input using the Scanner class. ⚠️ The nextLine() bug after nextInt() When we use nextInt() and then immediately call nextLine(), the nextLine() may get skipped. This happens because nextInt() does not consume the newline character left in the input buffer. ✔️ Solution: Add an extra sc.nextLine() to clear (flush) the buffer. Example: Scanner sc = new Scanner(System.in); System.out.print("Enter your marks: "); int marks = sc.nextInt(); sc.nextLine(); // flush the leftover newline System.out.print("Enter your name: "); String name = sc.nextLine(); 💻 Challenge I worked on today: Build a simple Report Card program that takes student details and marks using Scanner input. Step by step learning — improving Java fundamentals every single day 🚀 #Java #CoreJava #Scanner #JavaLearning #Programming #100DaysOfCode
Allaka Yamuna lakshmi’s Post
More Relevant Posts
-
🚀 Day 48 of My Java Learning Journey Today, I explored one of the most important concepts in Java – Collection Framework 💡 📌 What I Learned: Collection Framework is a set of classes and interfaces used to store and manipulate data efficiently It was introduced in JDK 1.2 by Josh Bloch Acts as an alternative to Data Structures in Java 📊 Key Components: Interfaces → List, Set, Queue, Map Classes → ArrayList, LinkedList, HashSet, HashMap 🔥 Why Collections? ✔ Dynamic size (no fixed length like arrays) ✔ Inbuilt methods (add, remove, etc.) ✔ Efficient data handling ✔ Reduces coding effort 💻 Key Features: Allows heterogeneous data Maintains insertion order (List) Allows duplicates (List) Improves performance in real-world applications 📈 Takeaway: Collection Framework is a must-know concept for interviews and real-time development. Almost every Java application uses it! #Day48 #Java #CollectionsFramework #JavaDeveloper #LearningJourney #Coding #Programming
To view or add a comment, sign in
-
-
🚀 Day 8/45 – Taking User Input in Java using Scanner On Day 8 of my Java learning journey, I learned how to make programs interactive by taking input from the user. Until now, I was using fixed values in my programs, but today I explored how to accept dynamic input using the Scanner class. 📚 What I Learned Today Today I learned: ✔ How to use the Scanner class from java.util package ✔ Taking input using methods like nextInt(), next(), and nextLine() ✔ Writing programs that respond based on user input 💻 Practice Work To apply my learning, I implemented: • Addition of two numbers using user input • Even or odd number checker using input • Simple interest calculator using user-provided values 🎯 Key Takeaway Taking input from users makes programs dynamic and interactive. This is an important step toward building real-world applications. Practicing daily is helping me improve both my coding and problem-solving skills. #Java #Programming #LearningInPublic #software #CodingJourney #SoftwareDevelopment #Consistency
To view or add a comment, sign in
-
Day 39 of learning java Today I learned something very important in Java, Object Creation. Syntax: "className objectName = new constructor();" Here’s what I understood: • The left side ("className objectName") is just declaring a reference variable. • The right side ("new constructor()") is where the actual object is created. • Memory is allocated only when we use the "new" keyword. • The constructor gets executed automatically when the object is created. • Without "new", no memory is allocated and no constructor runs. In short: Declaration != Object creation You need "new" to actually create and use the object. This concept made things much clear about how Java handles memory and execution internally. Thanks to my mentor Ashim Prem Mahto for the clear explanations and for always clearing my doubts. #Java #LearningJourney #Programming #JavaBasics #CodingLife #DeveloperJourney #TechLearning #Beginners #CodeNewbie #jvm #SoftwareEngineer #StudentLife
To view or add a comment, sign in
-
-
Day 38 of Learning Java Today, I explored how a class executes inside the JVM (Java Virtual Machine). Understanding this lifecycle really helped me see what happens behind the scenes when we run a Java program. 🔹 Class Loading • The JVM loads the class into memory • It brings the ".class" file into the system 🔹 Linking Phase • Verification → Checks bytecode for errors • Preparation → Allocates memory for static variables (default values like 0) • Resolution → Replaces symbolic references with actual memory references 🔹 Initialization • Static variables get their actual assigned values • Static blocks are executed 🔹 Execution • Methods start running and the program logic is executed 🔹 Destruction • Objects are destroyed and memory is cleaned up by the Garbage Collector Static variables first get default values during preparation, and later their actual values during initialization. Thanks to my mentor Ashim Prem Mahto for the clear explanations and for always clearing my doubts. #Java #JVM #LearningJourney #Programming #SoftwareDevelopment #BackendDevelopment #CodingLife #JavaDeveloper #TechLearning #StudentLife
To view or add a comment, sign in
-
-
Today I strengthened my understanding of how Java programs actually execute 🚀☕ Here’s what I learned step by step: ✔ The file name must match the public class name 📄 ✔ The main() method can be inside any class, not only the public class 🔍 ✔ Only one public class is allowed in one ".java" file ⚠️ ✔ Protected members outside the package are accessible through inheritance — 🔹 Non-static → accessed using child class object 🔹 Static → accessed using child class name or parent class name inside child class 👨👦✨ ✔ The JVM first loads the class that contains main(), then loads other required classes when needed 🧠 Understanding these core execution rules is helping me build stronger clarity in Java inheritance and access modifiers 💻📚 #Java #Programming #LearningJourney #OOP #JavaDeveloper #BackendDevelopment 🚀
To view or add a comment, sign in
-
☕ Learn Java with Me — Day 9 Text is everywhere in programming. Today we learned something simple, but extremely powerful. 👉 Strings in Java Strings are used to store text values. For example:String name = "Java"; Simple. But this is where real applications begin. With Strings, we can:→ store names → messages → email IDs → user inputs → passwords We also explored some useful methods:→ length() → toUpperCase() → toLowerCase() → equals() This made Java feel much more practical. Because every real-world application works with text. From numbers → real user interaction 🚀 We’re learning together 🤝 #java #coding #strings #learning #showup
To view or add a comment, sign in
-
-
When I first started learning Java, garbage collection felt like magic. 1)You create objects. 2)The program get runs. 3)Unused memory gets cleaned up. But Java memory is not just one big box. Here is the simple model: * New objects start in Young Generation * Long-living objects move to Old Generation * Unused objects get removed by the Garbage Collector Example: A temporary list created inside a method usually dies young and gets cleaned quickly. But something like cache data or a session object can survive longer and move to the Old Generation. That matters because: * Young Generation collection is usually fast * Old Generation collection is heavier * Understanding both helps you reason about performance #Java #SpringBoot #BackendDevelopment #SoftwareEngineerr #javadeveloper
To view or add a comment, sign in
-
-
📚 New article just published on SYUTHD! 🔖 Java 26 vs. Java 25 LTS: Performance Benchmarks and Migration Guide 🏷️ Category: Java Programming 📖 Full article → https://lnkd.in/g-DmkTDW 👉 Follow our page for more tech tutorials: https://lnkd.in/gsJDptPM 💬 Telegram: https://t.me/nisethtechno 👍 Facebook: https://lnkd.in/gsKv3Dyn #JavaProgramming #Tech #Tutorial #Programming #TechBlog #2026
To view or add a comment, sign in
-
🚀 Exploring Java Collection Framework Today’s session was all about understanding the powerful Java Collection Framework and how it helps in managing and organizing data efficiently. Dived deep into core concepts like interfaces and classes in collections, and explored the three main interfaces: List, Set, and Map. Gained clarity on how these structures differ and where to use them in real-world applications. Focused on the ArrayList class—its properties like dynamic resizing, ordered storage, and index-based access—making it one of the most commonly used collection classes in Java. Also understood the hierarchy of ArrayList, how it is part of the List interface, and how it inherits behavior from abstract classes like AbstractList and AbstractCollection. 📚 A strong foundation in collections is essential for writing efficient and scalable Java applications. TAP Academy #Java #CollectionsFramework #ArrayList #Programming #LearningJourney #FullStackDevelopment
To view or add a comment, sign in
-
-
Day 11| Java Collections + Problem Solving Today I focused on strengthening my understanding of the Java Collections Framework exploring core interfaces like List, Set, Map, and Queue, and learning when to use each based on performance and use cases by making a small project. GitHub repo: https://lnkd.in/g9K6_AhS Alongside that, I solved the “Trapping Rain Water” problem from the NeetCode 150 sheet. Two-Pointer Approach (Quick Intuition): Instead of checking every bar, we use two pointers (left & right) and track the maximum height seen from both sides. At each step, we move the pointer with the smaller max height, because water is always limited by the shorter boundary. This helps us calculate trapped water efficiently in one pass. hashtag GitHub repo: #Java #DSA #Collections #ProblemSolving #NeetCode150 #CodingJourney #LearningInPublic
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