NET-JAVA 六--------- 匿名类、内部类、
来源:互联网 发布:大数据在电商中的应用 编辑:程序博客网 时间:2024/04/30 21:16
package main;
public class InnerCls2 {
private void into(boolean b){
if(b){
class GDestination {
private String label;
public GDestination(String whereTo){
label = whereTo;
}
public String readLabel(){
return label;
}
}
GDestination destination = new GDestination("beijing");
System.out.println(destination.readLabel());
}
}
public void dest(boolean b){
into(b);
}
public static void main(String args[]){
InnerCls2 inner = new InnerCls2();
inner.dest(true);
}
}
package main;
public class TestInnerClass {
public static void main(String args[]){
Goods goodsObj = new Goods();
Contents content = goodsObj.dest();
System.out.println(content.value());
Destination destination = goodsObj.cont("描述信息:北京");
System.out.println(destination.readLabel());
}
}
interface Contents{
int value();
}
interface Destination{
String readLabel();
}
class Goods{
private int valueRate = 2;
private class Content implements Contents{
private int i = 11 * valueRate;
public int value(){
return i;
}
}
protected class GDestination implements Destination{
private String label;
private GDestination(String whereTo){
label = whereTo;
}
public String readLabel(){
return label;
}
}
public Content dest(){
return new Content();
}
public GDestination cont(String s){
return new GDestination(s);
}
}
- NET-JAVA 六--------- 匿名类、内部类、
- Java内部类,匿名类
- JAVA 匿名类和内部类 、匿名内部类
- java内部类,匿名类,匿名内部类
- JAVA中的匿名类、内部类和匿名内部类
- Java基础篇(内部类,匿名类,匿名内部类)
- JAVA匿名内部类
- java 匿名内部类
- JAVA匿名内部类
- java 匿名内部类
- JAVA匿名内部类
- java 匿名内部类
- JAVA匿名内部类
- java 匿名内部类
- JAVA匿名内部类
- Java匿名内部类
- JAVA匿名内部类
- java匿名内部类
- 测试分类
- 3.简单的数据校验
- 多路视频采集与输出
- MVC和Web下拉框视图及视图传值问题(入门教程)
- swift 2.0 枚举
- NET-JAVA 六--------- 匿名类、内部类、
- 杭电题目分类
- Ruby模块Module
- android wifi
- Nginx搭建反向代理服务器
- python中文件OS模块访问函数
- 4.访问web元素[1],容器获取
- Andorid内存检测工具:LeakCanary
- 如何让apache支持.htaccess 解决Internal Server Error The server …错误