外部类只能是public类型
内部类可以是protected,private类型
JAVA类型
4种整数类型
*4种整数类型
* byte 8位 -128-127
* short 16位 -32768 32767
* int 32
* long 64
2种浮点型
* float 32
* double 64
* 字符类型
* char 16
* 布尔类型
* boolean
/*语句结束标志
* break 跳出最内部循环
* continue 结束当前本次循环,加速循环的效果,直接执行下一次循环,最后执行循环体外的语句
* return 跳出整个方法体,循环体外的语句也不执行
*/
测试
package com.cn.p1;
import com.cn.p2.XClass;
public class AClass {//外部类只能是public,内部类可以protected,private
protected class dhdh
{
}
private class ddh{
}
BClass hh= new BClass();
XClass xx = new XClass();
/*4种整数类型
* byte 8位 -128-127
* short 16位 -32768 32767
* int 32
* long 64
* 2种浮点型
* float 32
* double 64
* 字符类型
* char 16
* 布尔类型
* boolean
*/
public static void main(String[] args) {
short shortA = 0;
int intA =1;
long longA = 2;
short a = (short)intA;
//breakTest();
// continueTest();
returnTest();
}
/*语句结束标志
* break 跳出最内部循环
* continue 结束当前本次循环,加速循环的效果,直接执行下一次循环,最后执行循环体外的语句
* return 跳出整个方法体,循环体外的语句也不执行
*/
public static void breakTest()
{
System.out.println("这是break语句测试");
int num[] = {10,20,30,40,50};
for(int i=0;i<50;i++)
{
for(int j:num)//只有等于数组里面才进来
{
if(j==30){
break;
}
System.out.println(j);
}
System.out.println("******break语句执行后,循环体以外的语句****");
}
}
public static void continueTest()
{
System.out.println("这是continue语句测试");
int num[] = {10,20,30,40,50};
for(int i=0;i<20;i++)
{
for(int j:num)//只有等于数组里面才进来
{
if(j==30){
continue;
}
System.out.println(j);
}
System.out.println("******continue语句执行后,循环体以外的语句****");
}
}
public static void returnTest()
{
System.out.println("这是return语句测试");
int num[] = {10,20,30,40,50};
for(int i=0;i<50;i++)
for(int j:num)//只有等于数组里面才进来
{
if(j==30){
return;
}
System.out.println(j);
}
System.out.println("******return语句执行后,循环体以外的语句****");
}
}
package com.cn.p1;
public class BClass {
}