java 基础类型是不是对象

路熊的架构之路 2018-02-26 03:39:47

看到ObjectInputStream源码的时候看到了这么一段代码, 集合是只能放入对象的,byte这种基础类型,怎么可以这样操作?byte.class是对应的包装类Byte么?求解释
...全文
323 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
原来如此,谢谢啦
soton_dolphin 2018-02-26
  • 打赏
  • 举报
回复
这只是用来获得基本类的 Class 对象, Class byteClass = byte.class, 因为直接用 byte.getClass() 会产生编译错误,因为byte是基础类型。 The .class Syntax If the type is available but there is no instance then it is possible to obtain a Class by appending ".class" to the name of the type. This is also the easiest way to obtain the Class for a primitive type. boolean b; Class c = b.getClass(); // compile-time error Class c = boolean.class; // correct Note that the statement boolean.getClass() would produce a compile-time error because a boolean is a primitive type and cannot be dereferenced. The .class syntax returns the Class corresponding to the type boolean. Class c = java.io.PrintStream.class; The variable c will be the Class corresponding to the type java.io.PrintStream. Class c = int[][][].class; The .class syntax may be used to retrieve a Class corresponding to a multi-dimensional array of a given type.
内容概要:本文围绕“基于双层共识控制的直流微电网优化调度”展开研究,提出了一种结合双层控制架构与共识算法的优化调度方法,旨在提升直流微电网在分布式能源接入背景下的协调控制能力与运行效率。上层采用集中式优化策略进行全局经济调度,下层则通过分布式共识控制实现各分布式电源间的自主协同,有效解决了系统中功率平衡、电压稳定与资源优化配置等问题。文中详细构建了数学模型,并利用Matlab进行仿真验证,结果表明该方法在动态负载变化与新能源波动条件下仍具备良好的鲁棒性与收敛性,能够实现高效、可靠的微电网能量管理。; 适合人群:具备一定电力系统、自动化或控制理论基础,熟悉Matlab仿真工具,从事新能源、微电网、智能电网等相关领域研究的研究生、科研人员及工程技术人员。; 使用场景及目标:① 掌握双层控制架构在微电网调度中的设计思路与实现方式;② 学习共识算法在分布式能源协调控制中的具体应用;③ 复现论文算法并拓展至多智能体协同、直流配电系统优化等研究方向; 阅读建议:此资源以论文复现为核心,建议读者结合Matlab代码深入理解算法实现细节,重点关注上下层控制器的信息交互机制与收敛条件设定,同时可尝试引入更多不确定性因素以增强模型实用性。

62,624

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧