Variables Constant and Literals in JAVA JAVA by Ravinder Nath Rajotiya - April 12, 20210 Variables variables are used to store data. They act as lebel and store items of different types. We only store only the types ment for a variable Primitive data types Primitive data type in JAVA are predefined. Table below shows various primitive data types along with the size and the range of numbers that can be accomodated in each type. Data Type Size Range of numbers byte 1 byte Integers (-128 to + 127 short 2 byte Integers(-32768 to 32767) int 4 byte Integers(-2,147,483,648 to +2,147,483,647) long 4 byte Integers(-9,223,372,036,854,775,808 to +9,223,372,036,854,775,807) float 4 byte Floating point numbers(+- 3.4E-38 to +/-3.4E38, 7 digit of accuracy) double 8 bytes Floating point numbers(+/-1.7E-308 to +/-1.7E308, 15 digit accuracy) Example To find the average, that is sum of two divide by ‘2’ which will be (20+5)/2= 12.5 which will be floating point, so need to declare average as
First Program HelloWorld in JAVA using IntelliJ JAVA by Ravinder Nath Rajotiya - April 12, 20210 Step-1 Launch Intellij double click the following IntelliJ icon to launch the IntelliJ Step-2: Click New Project Step-3: Select JAVA and click Next Step-4: Click Next Step-5: Name the Project and click finish The following screen will appear Step-6 Right Click src folder in project space Clcick New --> package and name the package packages is a namespace that will be required to contain everything in JAVA. Give name to package and click OK. We can arrange all our JAVA files in packages. packages is a namespace that organizes all related classes and interfaces. So basically we can think of packages as one that simulates folders in your systems for example html files in one folder, images in another folder, applications in yet another and so on. For now
Introduction to JAVA using IntelliJ JAVA by Ravinder Nath Rajotiya - April 12, 2021May 10, 20210 Installations of JAVA and IntelliJ 1. Install JAVA SE JDK : Install JAVA JDK-11 using the following command line: rn@rn-Lenovo-G50-30:~$ sudo apt install openjdk-11-jdk //Press Enter Once java is installed, you can verifyusing rn@rn-Lenovo-G50-30:~$ java --version //after finish te following message will be displayed openjdk 11.0.10 2021-01-19 OpenJDK Runtime Environment (build 11.0.10+9-Ubuntu-0ubuntu1.20.04) OpenJDK 64-Bit Server VM (build 11.0.10+9-Ubuntu-0ubuntu1.20.04, mixed mode, sharing) rn@rn-Lenovo-G50-30:~$ IntelliJ IntelliJ IDEA is a cross-platform IDE that provides consistent experience on the Windows, macOS, and Linux operating systems. We do not need to install Java to run IntelliJ IDEA because JetBrains Runtime is bundled with the IDE (based on JRE-11). However, to develop Java applications, a standalone JDK is required IntelliJ IDEA is available in