public class Dome4 {
public static void main ( String[ ] args) {
int i = 128 ;
byte b = ( byte ) i;
System. out. println ( i) ;
System. out. println ( b) ;
System. out. println ( "===============" ) ;
System. out. println ( ( int ) 23.7 ) ;
System. out. println ( ( int ) - 45.89f ) ;
System. out. println ( "===============" ) ;
char c = 'a' ;
int d = c+ 1 ;
System. out. println ( d) ;
System. out. println ( ( char ) d) ;
}
public class Dome5 {
public static void main ( String[ ] args) {
int money = 10 _0000_0000;
int years = 20 ;
int total = money* years;
long total2 = money* years;
long total3 = money* ( ( long ) years) ;
System. out. println ( total3) ;
}
}
变量
public class Dome6 {
public static void main ( String[ ] args) {
String name = "songchao" ;
char x = 'X' ;
double pi = 3.14 ;
}
}
变量作用域
public class Dome7 {
static double salary = 2500 ;
String name;
int age;
public static void main ( String[ ] args) {
int i = 10 ;
System. out. println ( i) ;
Dome7 demo7 = new Dome7 ( ) ;
System. out. println ( demo7. age) ;
System. out. println ( demo7. name) ;
System. out. println ( salary) ;
public void add ( ) {
}
}
}
常量
public class Demo8 {
static final double PI = 3.14 ;
public static void main ( String[ ] args) {
System. out. println ( PI) ;
}
}
变量的命名规范