💻 Learning Java – Finding the Second Maximum Value in an Array. Today I practiced an interesting Java program where I learned how to find the first maximum and second maximum values in an array. This helped me improve my understanding of arrays, loops, and conditional statements in Java. 🔹 What this program does: The program asks the user to enter the size of the array and the elements. After storing the values, it checks each number and identifies the largest and second largest numbers in the array. 🔹 Steps involved in the code: ✅ Take the array size from the user ✅ Store the array elements using a loop ✅ Display the array using Arrays.toString() ✅ Initialize two variables to track the maximum values ✅ Compare each element to find the highest value ✅ Update the second highest value when a new maximum is found ✅ Finally, print both the first and second maximum numbers 🔹 What I learned: This program improved my logical thinking and helped me understand how to compare values efficiently inside an array. Small programs like this are building my confidence in Java programming step by step. I’m excited to continue learning and exploring more concepts every day! 💻✨ #Java #Programming #CodingJourney #Arrays #Learning #StudentDeveloper #SoftwareDevelopment
Java Program: Finding Second Maximum Value in Array
More Relevant Posts
-
Understanding Loops in Java: For, While, and Do-While While learning Java Programming Fundamentals, understanding loops is essential because they help us execute a block of code repeatedly until a condition is met. 🔹 For Loop vs While Loop For Loop: Used when the number of iterations is known. Initialization, condition, and update are written in a single line. Commonly used for counting or iterating through arrays. Example: for(int i = 1; i <= 5; i++){ System.out.println(i); } While Loop: Used when the number of iterations is not known in advance. The loop runs as long as the condition is true. Example: int i = 1; while(i <= 5){ System.out.println(i); i++; } 🔹 While Loop vs Do-While Loop While Loop: Condition is checked before executing the loop. If the condition is false, the loop may not execute even once. Do-While Loop: Condition is checked after executing the loop. The loop will execute at least once, even if the condition is false. Example: int i = 1; do{ System.out.println(i); i++; }while(i <= 5); Key Takeaway: Use for loop when iterations are known. Use while loop when iterations depend on a condition. Use do-while loop when the loop must run at least once. Learning these concepts strengthens the foundation for writing efficient and structured Java programs. #Java #Programming #JavaBasics #Coding #SoftwareDevelopment #LearningJourney #AnandKumarBuddarapu
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
-
-
Learning Java for nearly two years has presented challenges, particularly in grasping concepts like inner classes and their various types. To facilitate my understanding, I began creating structured notes that are typed for easy updates and improvements over time. This effort has significantly enhanced my comprehension of Java concepts. I am sharing this document here in hopes that it may assist other Java developers or students in their learning journey. The document currently covers Java Inner Classes, including: - Regular Inner Classes - Method Local Inner Classes - Anonymous Inner Classes - Static Nested Classes Each section includes examples explaining how and when each type is used. Feel free to use it, and I would appreciate any feedback on its usefulness in your Java learning experience. #Java #JavaDeveloper #InnerClasses #JavaProgramming #Programming #JavaNotes
To view or add a comment, sign in
-
💻 Java Programming Practice – Count Repeated Character. Today I practiced a Java program to count how many times a character appears in a string. 📌 What this program does: • Takes a string input from the user • Takes a character to check • Compares the character with each letter in the string • Counts how many times the character appears ✅ Example: String: saravanan Character: a Output: Repeated character count = 4 💡 Concepts used in this program: ✔ Java Scanner input ✔ String methods ✔ For loop ✔ Character comparison I am practicing Java programs daily to improve my coding and problem-solving skills for IT placements. #Java #Programming #CodingPractice #JavaDeveloper #Learning #SoftwareDevelopment
To view or add a comment, sign in
-
-
💻 Java Programming Practice – Capitalize First Letter of Each Word. Today I practiced a Java program to capitalize the first letter of each word in a sentence. 📌 What this program does: • Takes a sentence input from the user • Splits the sentence into individual words • Converts the first character of each word to uppercase • Displays the updated sentence ✅ Example: Input: good morning Output: Good Morning 💡 Concepts used in this program: ✔ Java Scanner input ✔ String split() method ✔ Character array conversion ✔ Loops and conditions I am practicing Java programs daily to improve my coding and problem-solving skills for IT placements. #Java #Programming #CodingPractice #JavaDeveloper #Learning #SoftwareDevelopment
To view or add a comment, sign in
-
-
Random Java Knowledge Drop Did you know? 👀 In Java, calling run() on a thread does NOT create a new thread. It runs just like a normal method on the current thread. 👉 Only start() creates a new thread and calls run() internally. Why this matters: Many beginners think run() = multithreading ❌ This mistake can cause performance issues and bugs Small concepts like these make a big difference in real projects. Learning Java one concept at a time 🚀 More such small knowledge drops coming soon! 👍 Like if this was new to you 💬 Comment if you already knew this #Java #Learning #DeveloperTips #Programming #JavaDeveloper
To view or add a comment, sign in
-
Learning Java for nearly two years has presented challenges, particularly in finding well-structured notes that encompass everything in one place. To address this, I took the initiative to create my own notes—typed for easy updates and improvements over time. Although it required significant effort, the result has been rewarding. I am sharing this document here, hoping it will assist other Java developers or students in their learning journey. Currently, it covers all OOP concepts. #Java #ObjectOrientedProgramming #JavaDeveloper #Programming #JavaNotes
To view or add a comment, sign in
-
💻 Java Programming Practice – Find the Largest Word in a Sentence. Today I practiced a Java program to find the largest word in a sentence. 📌 What this program does: • Takes a sentence input from the user • Splits the sentence into individual words • Compares the length of each word • Displays the largest word in the sentence ✅ Example: Sentence: I am Dinesh from Tiruvannamalai Output: Largest word in the sentence = Tiruvannamalai 💡 Concepts used in this program: ✔ Java Scanner input ✔ String split() method ✔ Loops ✔ String length comparison I am practicing Java programs daily to improve my coding and problem-solving skills for IT placements. #Java #Programming #CodingPractice #JavaDeveloper #Learning #SoftwareDevelopment
To view or add a comment, sign in
-
-
Learning Java for nearly two years has presented challenges, particularly in finding well-structured notes that cover concepts clearly in one place. To address this, I started creating my own notes—typed so they can be easily updated and improved over time. It took a lot of effort, but the result has been very rewarding. I'm sharing this document here in case it helps other Java developers or students in their learning journey. This document currently covers Java Collections Framework concepts, including core interfaces, common implementations, and Concurrent Collections used in multithreaded environments. Feel free to use it, and let me know if it helps you in learning Java. #Java #JavaDeveloper #JavaCollections #ConcurrentProgramming #Programming #JavaNotes
To view or add a comment, sign in
-
📘 Understanding Java Strings-Class 01 Strings in Java are objects that represent a sequence of characters enclosed in double quotes. 🔹 Strings are of two types: Immutable – Cannot be changed (Example: Gender, Date of Birth) Mutable – Can be changed (Example: Password) 🔹 The String class in Java is immutable. 🔹 String Creation: Without new keyword → Stored in String Constant Pool With new keyword → Stored in Heap Memory 🔹 String Comparison Methods: == (Reference comparison) .equals() (Content comparison) .compareTo() (Lexicographical comparison) .equalsIgnoreCase() (Ignores case differences) ⚠️ Java is case-sensitive. TAP Academy #Java #CoreJava #Programming #Learning #Developers #JavaStrings
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