🔹 Java Program: Odd or Even Number Checker This Java program is designed to determine whether a given number is odd or even using simple conditional logic. 🔹 How the Program Works: The program uses the Scanner class to take input from the user. An integer value is stored in a variable. Using the modulus operator (%), the program checks the remainder when the number is divided by 2. If the remainder is 0, the number is even. Otherwise, the number is odd. Based on this condition, the appropriate message is printed to the console. 🔹 Key Concepts Used: Scanner for user input if-else conditional statement Modulus operator (%) Basic input/output operations 🔹 Output: Displays “is the even number” if the number is even Displays “is the odd number” if the number is odd This program is a great example of understanding basic Java syntax, conditional logic, and user input handling. Perfect for beginners who are learning Java fundamentals 🚀 #Java #JavaProgramming #CodingBasics #LearningJava #StudentDeveloper #Programming
More Relevant Posts
-
Understanding the First Two Types of Methods in Java In Java, methods help avoid writing all logic inside the main method by separating functionality into reusable blocks of code. Among them, the first two basic types are: 🔹 Methods with no input and no output These methods do not take any parameters and do not return any value. They are mainly used to perform actions such as displaying messages or executing fixed tasks. 🔹 Methods with no input but with output These methods do not accept parameters but return a value. The returned result can be stored or used by the calling method, making the code more reusable and structured. Using these methods keeps the program clean, readable, and aligned with good programming practices. Main method initiates execution; methods perform the work. 🚀 #Java #Methods #OOP #Programming #LearningJava #CleanCode #SoftwareDevelopment
To view or add a comment, sign in
-
-
🔥 DAY 24 – JAVA LEARNING SERIES After collections, it’s time to understand how Java bridges primitive data types with objects. This concept is widely used in collections, frameworks, and interview questions. 💡💻 📘 Today’s Focus: Wrapper Classes in Java 🔹 Why wrapper classes are needed 🔹 List of wrapper classes in Java 🔹 Primitive data types vs Wrapper classes 🔹 Autoboxing and Unboxing 🔹 Wrapper classes usage in Collections 🔹 Common interview questions on wrapper classes 📝 Practice Questions for Day 24 1️⃣ Convert primitive data to wrapper object and vice versa 2️⃣ Demonstrate autoboxing and unboxing with example 3️⃣ Store primitive values in an ArrayList using wrapper classes 4️⃣ Compare == and .equals() with wrapper objects 5️⃣ Explain why collections cannot store primitive data Are wrapper classes clear now? Comment CLEAR or CONFUSED 👇 #Java #JavaLearning #CoreJava #WrapperClasses #JavaDeveloper #ProgrammingJourney #100DaysOfCode #InterviewPreparation #Collections #BackendDeveloper
To view or add a comment, sign in
-
-
Day 7 – Java Variables & Memory Management ☕📘 Today, I learned about Variables in Java and how they are managed internally using memory allocation concepts. 🔹 Local Variables Declared inside methods, constructors, or blocks Stored in Stack Memory Created when a method is called and destroyed once execution ends No default values (must be initialized before use) 🔹 Instance Variables Declared inside a class but outside methods Stored in Heap Memory as part of the object Each object gets its own copy Have default values if not initialized 🧠 Memory Understanding Stack Memory → Stores method calls and local variables (fast & temporary) Heap Memory → Stores objects and instance variables (dynamic & shared) Understanding how variables interact with stack and heap memory gives deeper clarity on Java execution, performance, and memory efficiency. 📌 Learning Java is not just about syntax, but about understanding how things work internally. #Java #CoreJava #JavaVariables #MemoryManagement #StackAndHeap #LearningJourney #TapAcademy #Day7
To view or add a comment, sign in
-
-
Tokens in Java In Java, a token is the smallest meaningful unit of a program. The Java compiler uses tokens to understand and execute code. Tokens are basic building blocks of a Java program. Types of Tokens in Java Keywords – Reserved words with predefined meaning Example: int, class, if, for Identifiers – Names given to variables, classes, methods Example: myVar, Car, calculate() Literals – Fixed values assigned to variables Example: 10, 'A', "Java" Operators – Symbols that perform operations Example: +, -, *, /, == Separators (Punctuators) – Symbols that separate code elements Example: ;, {}, (), [] Comments – Ignored by the compiler, used for documentation Example: // single-line, /* multi-line */ 🔖 Hashtags for Tokens in Java #Java #JavaProgramming #ProgrammingBasics #Coding #LearnJava #SoftwareDevelopment #TechLearning #ProgrammingConcepts #OOPsJava #CodeBetter
To view or add a comment, sign in
-
-
📘 Core Java Day 14 | Different Ways to Create Objects in Java In Java, creating objects is not limited to just using the new keyword. While new is the most common ways is there, Here are the main ones: 1 Using new keyword - The standard way to create an object by calling a constructor. 2 Using Factory / Static Factory Methods - Object creation logic is moved to a method, which helps in loose coupling and better design. Example: Integer.valueOf() 3 Using Cloning - Creates a copy of an existing object without calling the constructor. 4 Using Reflection - Objects are created at runtime using class metadata. Commonly used in frameworks. 5 Using Deserialization - Objects are created from a stream (file or network), bypassing constructors. object creation in Java is about design, flexibility, and control
To view or add a comment, sign in
-
-
🚀 Variables & Constants in Java | Core Java Basics 💡 Variables and Constants are the building blocks of any Java program. Understanding them clearly helps you write clean, efficient, and bug-free code. 🔹 Variables in Java A variable is a container used to store data that can change during program execution. ✅ Types of Variables in Java: Local Variable – Declared inside a method Instance Variable – Declared inside a class (non-static) Static Variable – Shared across all objects of a class 📌 Example: int count = 10; 🔹 Constants in Java A constant is a variable whose value cannot be changed once assigned. ✅ Created using the final keyword 📌 Example: final double PI = 3.14159; 🔒 Constants improve: Code readability Safety Maintainability 🔍 Key Difference Variables Constants Value can change Value cannot change Flexible Fixed No final keyword Uses final keyword 🎯 Why This Matters? ✔ Strong foundation for OOP ✔ Avoids logical errors ✔ Frequently asked in Java interviews 📘 Learning Java step by step makes you a better developer. 🚀 Follow MD AZMAT RAZA for beginner-to-advanced Java & coding resources. #Java #CoreJava #JavaBasics #Programming #Coding #SoftwareEngineering #LearnJava
To view or add a comment, sign in
-
-
Learning in public | | Java Wrapper Classes Wrapper Classes(in-built) in Java and understood why they matter in real automation projects. Key learning 👇 Every primitive has a wrapper (int → Integer, boolean → Boolean) Wrapper classes help convert String → int / double / boolean Needed because UI data always comes as String Collections work with wrapper classes, not primitives Real-time QA use case 🧪 ➡️ Prices captured from UI are Strings ➡️ Convert them using wrapper classes ➡️ Perform calculations & validations correctly Example: String price1 = "10"; String price2 = "20"; int total = Integer.parseInt(price1) + Integer.parseInt(price2); // Result = 30 (not 1020) Small concept, big impact on test accuracy & stability 💡 Sharing as I learn 👨💻 #LearningInPublic #Java #AutomationTesting #QualityEngineering #WrapperClasses #Selenium
To view or add a comment, sign in
-
Day 15 Try-with-Resources Try-with-resources is a Java language construct (introduced in Java 7) that automatically closes resources such as files, streams, database connections, and sockets once the try block completes. It eliminates the need for explicit finally blocks to release resources. Before Java 7, developers had to manually close resources in a finally block, which was: Verbose Error-prone Susceptible to resource leaks if exceptions occurred Try-with-resources ensures deterministic resource cleanup. Key Requirement: Any resource used in try-with-resources must implement AutoCloseable (or Closeable). Examples: FileInputStream BufferedReader Connection PreparedStatement ResultSet #Java #Trywithresourse #JavaCollections #InterviewPreparation #CoreJava #DataStructures #SoftwareEngineering #JavaDeveloper #CodingInterview #LinkedInLearning #Javalnterview #Programming #BackendDeveloper #SoftwareEngineering #LearnJava #DailyJava #ITCareers #TechLearning #Coding #DeveloperLife #JavaCommunity
To view or add a comment, sign in
-
-
#Day33/50 🚀 Day 33- Java Series: 🔐 Access Modifiers in Java: Access modifiers control the visibility and accessibility of classes, methods, variables, and constructors in Java. They are key to encapsulation and security in OOP. 1️⃣ private Accessible only within the same class Used to protect data from outside access class Test { private int x = 10; } 2️⃣ default (no keyword) Accessible within the same package Also called package-private class Test { int x = 20; } 3️⃣ protected Accessible within the same package Also accessible in child classes (even in other packages) class Test { protected int x = 30; } 4️⃣ public Accessible from anywhere Used when members must be globally available class Test { public int x = 40; } #Java #CoreJava #OOP #Encapsulation #AccessModifiers #JavaDeveloper #Programming Raviteja T Mohammed Abdul Rahman 10000 Coders
To view or add a comment, sign in
-
-
Day 8.... 💡 Today I Learned: Pass by Value vs Pass by Reference in Java While exploring Java, I learned how data is passed between variables and methods — and it finally made sense! 😄 ✨ Pass by Value: Java copies only the value of a variable, not the original one. So, changes made to the new variable don’t affect the original. 🚗 Pass by Reference: When it comes to objects, both variables can refer to the same memory address. So, updating one will reflect in the other. 🧠 In short: 🔹 Primitives → Pass by Value (independent copies) 🔹 Objects → Pass by Reference (shared memory) Learning this helped me clearly understand how Java handles data in memory! 🚀 #Java #TapAcademy #CodingJourney #LearningInPublic #JavaConcepts
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
Keep up the good work