Day 9 of Java 50 Days of Code Challenge Imagine you’re checking your contact list — name and number — and you want to print them neatly, one by one. That’s exactly what I learned today: how to loop through a Map in Java. Maps store key–value pairs, and there are different ways to read them. Today I practiced using for-each loops to go through keys, values, and entries. Lesson of the Day: > Looping through a Map feels like flipping through your phonebook — one contact at a time. Next, I’ll explore ArrayLists with user input — to make my programs more dynamic and interactive. #Java #50DaysOfCode #Day9 #LearningJourney #CodingStory #MapIteration #JavaCollections Here’s my little example: Guess the output
How to loop through a Map in Java
More Relevant Posts
-
🎬 “You can’t control everything… but you can suggest it.” That’s true for life — and for Java threads too. 😄 In my latest video, I explored how to guide thread execution using thread priority and the sleep() method in Java. 💡 Here’s what we discussed: Understanding thread priorities — from MIN_PRIORITY (1) to MAX_PRIORITY (10) Why setting a high priority doesn’t guarantee faster execution (it’s all up to the scheduler!) Using Thread.sleep() to pause execution and bring synchronized rhythm between threads Real-world analogy: how schedulers decide which thread gets the stage light first This simple experiment of making “Tony” and “Star” dance in sync taught me something deeper — sometimes optimization is about timing, not control. Check out the video here 🎥 👉 https://lnkd.in/gvufSmTj #Java #Multithreading #Threads #Coding #SoftwareEngineering #LearningInPublic
Mastering Thread Priority and Sleep in Java — Control Thread Execution Like a Pro
https://www.youtube.com/
To view or add a comment, sign in
-
Day 24 of #50DaysOfCode – Java 💻 Today’s challenge was to check whether a number is an Automorphic Number. An Automorphic Number is a number whose square ends with the same digits as the number itself. Examples: 5 → 25 ✔️ (ends with 5) 76 → 5776 ✔️ (ends with 76) This problem helped me understand digit comparison, modulus operations, and number patterns in Java 🔍✨ #Java #CodingChallenge #50DaysOfCode #LearnToCode #ProgrammingBasics #LogicBuilding #CodeDaily #ProblemSolving #AutomorphicNumber #JavaBeginner
To view or add a comment, sign in
-
Day 20 of #50DaysOfCode – Java Today’s task: Find the sum of all odd digits in a given number! 🔢 A simple yet logical exercise that helps strengthen your understanding of loops, conditionals, and digit manipulation. 💡 👉 This program takes a number as input and calculates the total of its odd digits using a while loop and the modulus operator. #Java #CodingChallenge #50DaysOfCode #LearnToCode #ProgrammingBasics #LogicBuilding #CodeEveryday #JavaProgramming
To view or add a comment, sign in
-
In Java 25, you don’t even need to write the class name, public static void main(String[] args), or System.out.println() anymore 😲 Just type: void main() { IO.println("Java 25 Version The Game Changer"); } …and it runs perfectly! 🚀 Java 25 is truly “The Game Changer.” 🔥 #Java #Java25 #Coding #Programming #Developer #JDK25 #Innovation #JavaUpdates
To view or add a comment, sign in
-
Day 18 of #50DaysOfCode – Java Today’s challenge: Calculate the Product of Digits in a Number! A simple yet logical problem that enhances understanding of loops and arithmetic operations 💡 📘 Example: Input → 234 Output → 24 (2 × 3 × 4 = 24) #Java #CodingChallenge #50DaysOfCode #CodeEveryday #LogicBuilding #LearnToCode #ProgrammingBasics
To view or add a comment, sign in
-
Deadlock in Java A Deadlock happens when two or more threads are blocked forever — waiting for each other’s resources. This usually occurs when each thread holds a lock and is waiting for another lock to be released. Example scenario: Thread A has Lock1 and waiting for Lock2 Thread B has Lock2 and waiting for Lock1 Both are stuck → this is DEADLOCK ❌ Why it happens? Because of circular dependency between threads. How to prevent it? Always acquire locks in same order Use tryLock() (ReentrantLock) Minimize synchronized blocks Avoid nested locks Conclusion Deadlocks can freeze your entire application. As developers, we must design our locking strategy carefully in multithreading to avoid such situations. #Java #Multithreading #Deadlock #ThreadLifeCycle #JavaDeveloper #LearningJourney #100DaysOfCode #TapAcademy 🚀
To view or add a comment, sign in
-
-
Week 8 || Day 2💡 Reversing words in Java — step by step! Today I practiced reversing each word in a sentence using two different approaches: 🔹 Approach 1 — With .reverse() method: Split the sentence using split(" ") to separate words. Used StringBuffer for each word and applied .reverse() directly. Joined the reversed words back with spaces. 🔹 Approach 2 — Without using .reverse(): Again split the string into words. For each word, used a for loop running from the last character to the first. Appended each character manually into a new StringBuffer. Combined the reversed words carefully, avoiding extra spaces.⚡ #Java #StringBuffer #ProgrammingLogic #JavaFullStack
To view or add a comment, sign in
-
Excited to share my latest mini-project: a Temperature Converter built in Java! 🌡️ It converts between Celsius and Fahrenheit using a clean ternary operator approach. Great practice for mastering conditional logic and variable handling. #Java #CodingProjects #LearnByBuilding #SoftwareDevelopment GitHub repo:https://lnkd.in/ewB8XUJn
To view or add a comment, sign in
-
🎯 LeetCode — Day 3 | “Longest Substring Without Repeating Characters” (Medium, Java) 💭 Ever tried remembering all your passwords without repeating any character? That’s pretty much what this problem felt like 😅 Today’s challenge tested my patience and precision — finding the longest substring without repeating characters. 🧩 Key Idea: Use a sliding window with a HashMap to track character positions. Every time a duplicate appears, move the start pointer forward ->simple, elegant, efficient! ⚡ Result: ✅ Accepted | ⏱ Runtime: 0 ms 💪 Complexity: O(n) 💡 Logic: Focus on “expanding and shrinking” the window smartly Each day’s logic builds the next day’s confidence. #LeetCode #Day3 #Java #CodingJourney #ProblemSolving #DSA #TechMindset #Motivation
To view or add a comment, sign in
-
-
💥 “𝘛𝘩𝘪𝘯𝘬 𝘊𝘰𝘭𝘭𝘦𝘤𝘵𝘪𝘰𝘯𝘴.𝘴𝘰𝘳𝘵() 𝘪𝘴 𝘢𝘭𝘭 𝘺𝘰𝘶 𝘯𝘦𝘦𝘥? 𝘞𝘢𝘪𝘵 𝘵𝘪𝘭𝘭 𝘺𝘰𝘶 𝘮𝘦𝘦𝘵 𝘊𝘰𝘮𝘱𝘢𝘳𝘢𝘵𝘰𝘳 𝘢𝘯𝘥 𝘊𝘰𝘮𝘱𝘢𝘳𝘢𝘣𝘭𝘦!” Sorting in Java gets really fun when you start adding your own logic. In my latest video, I’ve explained how to sort not just integers — but your custom objects (like students, names, anything!) — using Comparator, Comparable, and Lambda expressions. 📺 Watch the full breakdown here: https://lnkd.in/gkvb2VxY #Java #Programming #Coding #Comparator #Comparable #LearnJava #SoftwareDevelopment
4) Comparator vs Comparable in Java | Sort List, Custom Logic & Lambda Explained
https://www.youtube.com/
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