uk
Feedback
Tech Jargon - Decoded

Tech Jargon - Decoded

Відкрити в Telegram

Confused by tech terms? Don’t worry, we’ve got you 🤝 We make things simple, one concept at a time. Learn daily Easy & clear Turn Confusion into clarity. #tech #it #softwareengineer #cs #development

Показати більше
2 018
Підписники
Немає даних24 години
-77 днів
-4030 день
Архів дописів
💻 Check if Year is Leap Year
import java.util.Scanner;

public class LeapYearChecker {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("Enter a year: ");
        int year = scanner.nextInt();

        boolean isLeapYear = false;

        if (year % 4 == 0) {
            if (year % 100 == 0) {
                if (year % 400 == 0) {
                    isLeapYear = true;
                }
            } else {
                isLeapYear = true;
            }
        }

        if (isLeapYear) {
            System.out.println(year + " is a leap year.");
        } else {
            System.out.println(year + " is not a leap year.");
        }

        scanner.close();
    }
}
📤 Output:
Input: 2024
Output: 2024 is a leap year.

Input: 2023
Output: 2023 is not a leap year.

Input: 1900
Output: 1900 is not a leap year.

Input: 2000
Output: 2000 is a leap year.

💻 Check if Character is Vowel
import java.util.Scanner;

public class VowelChecker {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter a character: ");
        char inputChar = scanner.next().charAt(0);

        if (inputChar == 'a' || inputChar == 'e' || inputChar == 'i' || inputChar == 'o' || inputChar == 'u' ||
            inputChar == 'A' || inputChar == 'E' || inputChar == 'I' || inputChar == 'O' || inputChar == 'U') {
            System.out.println(inputChar + " is a vowel.");
        } else {
            System.out.println(inputChar + " is not a vowel.");
        }

        scanner.close();
    }
}
📤 Output:
Input: A
Output: A is a vowel.

Input: b
Output: b is not a vowel.

Input: u
Output: u is a vowel.

Input: Z
Output: Z is not a vowel.

🚀100 Days of LeetCode 2025 Challenge started Join below channel to be part of this challenge 🔗https://t.me/+utZsK17rSXRmZWQ
🚀100 Days of LeetCode 2025 Challenge started Join below channel to be part of this challenge 🔗https://t.me/+utZsK17rSXRmZWQ1

💻 Check if Number is Even
import java.util.Scanner;

public class CheckIfNumberIsEven {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter a number: ");
        int number = scanner.nextInt();

        if (number % 2 == 0) {
            System.out.println(number + " is an even number.");
        } else {
            System.out.println(number + " is not an even number.");
        }

        scanner.close();
    }
}
📤 Output:
Input: 4
Output: 4 is an even number.

Input: 7
Output: 7 is not an even number.

💻 Check if Number is Positive
import java.util.Scanner;

public class CheckIfPositive {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);

        System.out.print("Enter a number: ");
        int number = input.nextInt();

        if (number > 0) {
            System.out.println("The number is positive.");
        } else {
            System.out.println("The number is not positive.");
        }

        input.close();
    }
}
📤 Output:
Input: 5
Output: Enter a number: The number is positive.

Input: -3
Output: Enter a number: The number is not positive.

Input: 0
Output: Enter a number: The number is not positive.

Conditional Statements - Simple if

💻 Command line arguments usage
import java.util.Scanner;

public class CommandLineArgumentsUsage {

    public static void main(String[] args) {

        if (args.length == 0) {
            System.out.println("No command line arguments were provided.");
        } else {
            System.out.println("You have provided the following command line arguments:");

            for (int i = 0; i < args.length; i++) {
                System.out.println("Argument " + (i + 1) + ": " + args[i]);
            }
        }

        //Example of using command line arguments to perform addition
        if (args.length == 2) {
            try {
                int num1 = Integer.parseInt(args[0]);
                int num2 = Integer.parseInt(args[1]);

                int sum = num1 + num2;
                System.out.println("Sum of " + num1 + " and " + num2 + " is: " + sum);

            } catch (NumberFormatException e) {
                System.out.println("Please provide valid integer arguments.");
            }
        }

    }
}
📤 Output:
First execution (no command line arguments):
No command line arguments were provided.

Second execution (command line arguments: "hello", "world"):
You have provided the following command line arguments:
Argument 1: hello
Argument 2: world

Third execution (command line arguments: "10", "20"):
You have provided the following command line arguments:
Argument 1: 10
Argument 2: 20
Sum of 10 and 20 is: 30

Fourth execution (command line arguments: "10", "abc"):
You have provided the following command line arguments:
Argument 1: 10
Argument 2: abc
Please provide valid integer arguments.

💻 Input using Scanner class
import java.util.Scanner;

public class ScannerInputExample {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter your name: ");
        String userName = scanner.nextLine();

        System.out.print("Enter your age: ");
        int userAge = scanner.nextInt();

        // Consume the newline character left by nextInt()
        scanner.nextLine();

        System.out.print("Enter your city: ");
        String userCity = scanner.nextLine();

        System.out.println("Your name is: " + userName);
        System.out.println("Your age is: " + userAge);
        System.out.println("You are from: " + userCity);

        scanner.close(); // Close the scanner
    }
}
📤 Output:
Input: John Doe
Input: 30
Input: New York

Output: Enter your name: Enter your age: Enter your city: Your name is: John Doe
Your age is: 30
You are from: New York

💻 Swap First and Last Digits of a Number
import java.util.Scanner;

public class SwapFirstAndLastDigit {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter a number: ");
        int number = scanner.nextInt();

        if (number < 0) {
            number = -number; // Handle negative numbers by making them positive for processing
        }

        if (number < 10) {
            System.out.println("Number should have at least two digits.");
        } else {
            int lastDigit = number % 10;
            int tempNumber = number;
            int firstDigit = 0;
            int divisor = 1;

            while (tempNumber >= 10) {
                tempNumber /= 10;
                divisor *= 10;
            }
            firstDigit = tempNumber;

            int middlePart = (number % divisor) / 10; // Extract the middle part of the number

            int swappedNumber = lastDigit * divisor + middlePart * 10 + firstDigit;

            System.out.println("Number after swapping first and last digit: " + swappedNumber);
        }

        scanner.close();
    }
}
📤 Output:
Input: 12345
Output: Enter a number: Number after swapping first and last digit: 52341

Input: 9876
Output: Enter a number: Number after swapping first and last digit: 6879

Input: 10
Output: Enter a number: Number after swapping first and last digit: 1

Input: 5
Output: Enter a number: Number should have at least two digits.

Input: -123
Output: Enter a number: Number after swapping first and last digit: -321

Input: 100
Output: Enter a number: Number after swapping first and last digit: 1

💻 Seconds to Hours:Minutes:Seconds Converter
import java.util.Scanner;

public class SecondsToHoursMinutesSecondsConverter {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter the number of seconds: ");
        int totalSeconds = scanner.nextInt();

        int hours = totalSeconds / 3600;
        int remainingSeconds = totalSeconds % 3600;
        int minutes = remainingSeconds / 60;
        int seconds = remainingSeconds % 60;

        System.out.println("Hours: " + hours);
        System.out.println("Minutes: " + minutes);
        System.out.println("Seconds: " + seconds);

        scanner.close();
    }
}
📤 Output:
Input: 3661
Output: Enter the number of seconds: Hours: 1
Output: Minutes: 1
Output: Seconds: 1

Input: 7200
Output: Enter the number of seconds: Hours: 2
Output: Minutes: 0
Output: Seconds: 0

Input: 60
Output: Enter the number of seconds: Hours: 0
Output: Minutes: 1
Output: Seconds: 0

Input: 59
Output: Enter the number of seconds: Hours: 0
Output: Minutes: 0
Output: Seconds: 59

💻 Calculate BMI (Body Mass Index)
import java.util.Scanner;

public class BodyMassIndexCalculator {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter your weight in kilograms: ");
        double weightInKilograms = scanner.nextDouble();

        System.out.print("Enter your height in meters: ");
        double heightInMeters = scanner.nextDouble();

        // Calculate BMI
        double bmi = weightInKilograms / (heightInMeters * heightInMeters);

        System.out.println("Your BMI is: " + bmi);

        scanner.close();
    }
}
📤 Output:
Input: 70
Input: 1.75
Output: Your BMI is: 22.857142857142858

💻 Print Your Name, Age, and Hobby
import java.util.Scanner;

public class PersonalDetails {

    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);

        System.out.print("Enter your name: ");
        String yourName = input.nextLine();

        System.out.print("Enter your age: ");
        int yourAge = input.nextInt();
        input.nextLine(); // Consume newline left by nextInt()

        System.out.print("Enter your hobby: ");
        String yourHobby = input.nextLine();

        System.out.println("Your Name: " + yourName);
        System.out.println("Your Age: " + yourAge);
        System.out.println("Your Hobby: " + yourHobby);

        input.close();
    }
}
📤 Output:
Input: Alice
Input: 30
Input: Reading
Output: Enter your name: Enter your age: Enter your hobby: Your Name: Alice
Your Age: 30
Your Hobby: Reading

💻 Celsius to Fahrenheit Converter
import java.util.Scanner;

public class CelsiusToFahrenheitConverter {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter temperature in Celsius: ");
        double celsius = scanner.nextDouble();

        double fahrenheit = (celsius * 9 / 5) + 32;

        System.out.println("Temperature in Fahrenheit: " + fahrenheit);

        scanner.close();
    }
}
📤 Output:
// Code not available

💻 Fahrenheit to Celsius Converter
import java.util.Scanner;

public class FahrenheitToCelsiusConverter {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter temperature in Fahrenheit: ");
        double fahrenheit = scanner.nextDouble();

        double celsius = (fahrenheit - 32) * 5 / 9;

        System.out.println("Temperature in Celsius: " + celsius);

        scanner.close();
    }
}
📤 Output:
Input: 68
Output: Temperature in Celsius: 20.0

Input: 212
Output: Temperature in Celsius: 100.0

Input: 32
Output: Temperature in Celsius: 0.0

Input: -40
Output: Temperature in Celsius: -40.0

💻 Area of Rectangle Calculator
import java.util.Scanner;

public class RectangleAreaCalculator {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter the length of the rectangle: ");
        double length = scanner.nextDouble();

        System.out.print("Enter the breadth of the rectangle: ");
        double breadth = scanner.nextDouble();

        double area = length * breadth;

        System.out.println("The area of the rectangle is: " + area);

        scanner.close();
    }
}
📤 Output:
Input: 5
Input: 10
Output: The area of the rectangle is: 50.0

💻 Area of Circle Calculator
import java.util.Scanner;

public class AreaOfCircleCalculator {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter the radius of the circle: ");
        double radius = scanner.nextDouble();

        double area = Math.PI * radius * radius;

        System.out.println("The area of the circle is: " + area);

        scanner.close();
    }
}
📤 Output:
Input: 5
Output: Enter the radius of the circle: The area of the circle is: 78.53981633974483

💻 Compound Interest Calculator
import java.util.Scanner;

public class CompoundInterestCalculator {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter the principal amount: ");
        double principalAmount = scanner.nextDouble();

        System.out.print("Enter the rate of interest (in percentage): ");
        double rateOfInterest = scanner.nextDouble();
        rateOfInterest = rateOfInterest / 100; // Convert percentage to decimal

        System.out.print("Enter the time period (in years): ");
        double timePeriod = scanner.nextDouble();

        System.out.print("Enter the number of times interest is compounded per year: ");
        int compoundingFrequency = scanner.nextInt();

        // Calculate compound interest
        double amount = principalAmount * Math.pow(1 + (rateOfInterest / compoundingFrequency), compoundingFrequency * timePeriod);
        double compoundInterest = amount - principalAmount;

        System.out.println("Compound Interest: " + compoundInterest);

        scanner.close();
    }
}
📤 Output:
Enter the principal amount: Input: 1000
Enter the rate of interest (in percentage): Input: 5
Enter the time period (in years): Input: 3
Enter the number of times interest is compounded per year: Input: 12
Compound Interest: 161.47754328277153

💻 Simple Interest Calculator
import java.util.Scanner;

public class SimpleInterestCalculator {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter the principal amount: ");
        double principalAmount = scanner.nextDouble();

        System.out.print("Enter the rate of interest (in percentage): ");
        double rateOfInterest = scanner.nextDouble();

        System.out.print("Enter the time period (in years): ");
        double timePeriod = scanner.nextDouble();

        // Calculate simple interest
        double simpleInterest = (principalAmount * rateOfInterest * timePeriod) / 100;

        System.out.println("Simple Interest = " + simpleInterest);

        scanner.close();
    }
}
📤 Output:
Input: 1000
Input: 5
Input: 2
Output: Simple Interest = 100.0

💻 Variable Swapping (Three Variables)
import java.util.Scanner;

public class VariableSwappingThreeVariables {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter the value of first variable (a): ");
        int a = scanner.nextInt();

        System.out.print("Enter the value of second variable (b): ");
        int b = scanner.nextInt();

        System.out.print("Enter the value of third variable (c): ");
        int c = scanner.nextInt();

        System.out.println("Before swapping: a = " + a + ", b = " + b + ", c = " + c);

        // Swapping logic
        int temp = a;
        a = b;
        b = c;
        c = temp;

        System.out.println("After swapping: a = " + a + ", b = " + b + ", c = " + c);

        scanner.close();
    }
}
📤 Output:
Input: 10
Input: 20
Input: 30
Output: Before swapping: a = 10, b = 20, c = 30
Output: After swapping: a = 20, b = 30, c = 10

💻 Variable Swapping (Two Variables)
import java.util.Scanner;

public class VariableSwapping {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter the value of first number: ");
        int firstNumber = scanner.nextInt();

        System.out.print("Enter the value of second number: ");
        int secondNumber = scanner.nextInt();

        System.out.println("Before swapping:");
        System.out.println("First number = " + firstNumber);
        System.out.println("Second number = " + secondNumber);

        // Swapping logic
        int temp = firstNumber;
        firstNumber = secondNumber;
        secondNumber = temp;

        System.out.println("After swapping:");
        System.out.println("First number = " + firstNumber);
        System.out.println("Second number = " + secondNumber);

        scanner.close();
    }
}
📤 Output:
Input: 5
Input: 10
Output: Enter the value of first number: Enter the value of second number: Before swapping:
First number = 5
Second number = 10
After swapping:
First number = 10
Second number = 5