Java basic data types and operators

 

 

floating point type:

 

Floating-point numbers cannot accurately represent all decimals, and there are errors, because for example, how many decimals are in [0,1],

In fact, there are countless, but float is 4 bytes so there is a rounding error.

 

 

BigInteger Big Integer, bigger than Long BigDecimal Big Decimal/Exact Decimal  

 



 



 

 

Character type:

 

character is character

Strings are made up of multiple characters

 

The char type is used to indicate that all characters in unicode encoding occupy 2 bytes, which is 16 bits, 2 to the 8th power 

unicode encoding, an encoding method that is universal in the world

 



 

 Bitwise operators:

 



 
 
 switch :

 

	public static void main(String[] args) {
		// Under jdk1.7, switch can accept strings and generally accept int types

		String a = "spring" ;
		switch(a) {
		case  "spring" :
			System.out.println("Autumn is coming");
			break;
		case  "summer" :
			System.out.println("summer is coming");
			break;
	    default :
	    	System.out.println("default");
			break;
		}
		
	}

 
 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326393219&siteId=291194637