Learning Java: Interactive Programs and Operators

💬 Day 6 of My Journey to Learning Java ☕ Today’s focus was on making my programs more interactive and logical — learning how to take user input, perform calculations, and use operators effectively. Here’s what I explored 👇 🔹 Basic I/O in Java: Learned how to use the Scanner class to take input from users. Example: import java.util.Scanner; Scanner sc = new Scanner(System.in); int num = sc.nextInt(); It’s amazing how a few lines can make a program feel alive — accepting input and responding dynamically. 🔹 Arithmetic & Unary Operators: Practiced how operators control the logic of calculations: Arithmetic Operators: +, -, *, /, % — used for performing basic mathematical operations. Unary Operators: ++ and -- — used to increase or decrease a value by 1. Example: int a = 5; System.out.println(++a); // Pre-increment → 6 System.out.println(a++); // Post-increment → 6, then becomes 7 🔹 Hands-On Practice: Solved small but powerful problems today 💡 ✔️ Swapping two numbers without a third variable ✔️ Calculating Simple Interest ✔️ Practiced several MCQs to strengthen fundamentals 💡 Reflection: Today’s practice helped me connect syntax with problem-solving. Writing code that actually takes input, performs logic, and returns output — that’s when programming starts to feel real. #Java #JavaLearning #ProgrammingJourney #100DaysOfCode #CodeEveryday #LearnInPublic #DeveloperInMaking #BackendDevelopment #JavaDeveloper

To view or add a comment, sign in

Explore content categories