class MyData{
volatile int number = 0;
public void addTo60(){
this.number = 60;
}
}
class Person{
String name = "";
String [] measurement = new String [] {"A","B","C"};
public String getPersonName() {
return name;
}
}
class Student extends Person{
int studentId = 0;
public void showStudentId() {
System.out.println("StudentId is " + studentId);
}
}
public class VolatileDemo {
public static void main(String[] args) {
Student xiaoMing = (Student) new Person();
if (xiaoMing instanceof Person) {
System.out.println(xiaoMing.getPersonName());
}else
{
System.out.println("error in classCastException.");
}
xiaoMing.getPersonName();
int stepInt = 3;
stepInt = stepInt << 4;
System.out.println(">> " + stepInt);
stepInt = stepInt >> 2;
System.out.println(">> " + stepInt);
}
}