[Java] Java Learning 1 (Learn different data types)

less than 1 minute read

Article purpose

Since I decided to use Java in my work,
to output basic Java usage and organize my knowledge.


public class MyApp{
   public static void main(String[] args){
   // letter
   char a ='a';
   // integer byte short int long
   int x = 10;
   long y = 5555555555L; // Add L at the end for long type.

   // float double
   double d = 23423.344;
   float f = 32.33F;
   // boolean
   boolean flag = true; //false
   // string
   // \n
   // \t
   // String msg;
   // msg = "Hello World Again!"
   String msg = "Hello Wor\nld! Again";


Output result

$ javac MyApp.java
$ java MyApp
Hello Wor
ld! Again