class Threadxx extends Thread{
.....
}
public class testThread
{
public static void main(String[] args){
Threadxx thread1=new Threadxx();
thread1.start();
}
}
这里的thread1是类的实例吗?
.....
}
public class testThread
{
public static void main(String[] args){
Threadxx thread1=new Threadxx();
thread1.start();
}
}
这里的thread1是类的实例吗?
父类对象就是子类的实列了。建议看看 孙鑫关于 学习java无难事 这个视频,看了很多东西自然就明白了,
利用 static 可以不用实例化!!
public class RotateArray{
public static void reverse(int[]array,int start,int end){
if(start>array.length||end>array.length){
System.out.println("the number out of Bounds");
return;
}
while(start<end){
int temp;
temp=array[start];
array[start]=array[end];
array[end]=temp;
start++;
end--;
}
}
public static void main (String[]args){
int[] a=new int[]{0,1,2,3,4,5,6,7,8,9,10};
int b=a.length;
RotateArray.reverse(a,0,5);
RotateArray.reverse(a,6,b-1);
RotateArray.reverse(a,0,b-1);
for(int i=0;i<b;i++){
System.out.print(a[i]+" ");
}
}
}