JAVA

By C-ore - January 11, 2021


 What is Java?

  • Platform independent - We can write Java code in one platform (operating system) and run on another platform without any modification.
  • Object-oriented - Java is an object-oriented language. This helps to make our Java code more flexible and reusable.
  • Speed - Well optimized Java code is nearly as fast as lower-level languages like C++ and much faster than Python, PHP, etc.

Why Learn Java?

  • Java is a platform-independent language. We can write Java code in one platform and run it in another platform
  • Java is a general-purpose language with a wide range of applications. It's used for developing mobile and desktop applications, big data processing, embedded systems, and so on.
  • Java is an object-oriented programming language. It helps in code reusability.

JOB ROLES FOR JAVA DEVELOPERS:

  • Software Developer – C
  • Programmer Analyst – C
  • C Consultant
  • Software Engineer – C++
  • Embedded Developer – OOPS
  • Module Lead – Core Java
  • Sr Developer – Core Java
  • Software Engineer – Core Java
  • Core Java Developer
  • Architect – Core Java
  • Software Engineer – JSP
  • Application Developer – JSP
  • Software Engineer – Servlets
  • UI Developer – JS
  • IoT Software Engineer
  • Lead Developer – Angular JS

How to Print an Integer entered by an user

import java.util.Scanner;

public class HelloWorld {

    public static void main(String[] args) {

        // Creates a reader instance which takes
        // input from standard input - keyboard
        Scanner reader = new Scanner(System.in);
        System.out.print("Enter a number: ");

        // nextInt() reads the next integer from the keyboard
        int number = reader.nextInt();

        // println() prints the following line to the output screen
        System.out.println("You entered: " + number);
    }
}

Program to Add Two Integers

public class AddTwoIntegers {

    public static void main(String[] args) {
        
        int first = 10;
        int second = 20;

        System.out.println("Enter two numbers: " + first + " " + second);
        int sum = first + second;

        System.out.println("The sum is: " + sum);
    }
}

Check whether a number is even or odd using if...else statement

import java.util.Scanner;

public class EvenOdd {

    public static void main(String[] args) {

        Scanner reader = new Scanner(System.in);

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

        if(num % 2 == 0)
            System.out.println(num + " is even");
        else
            System.out.println(num + " is odd");
    }
}

  • Share:

You Might Also Like

0 comments