1.
public class A { public static void main(String[] args) { Float f = new Float(0.9f); Float g = new Float(0.9f); Double d = new Double(0.9); System.out.println(f == g); System.out.println(f.equals(d)); System.out.println(f.equals(g)); System.out.println(f.equals(new Float(0.9f))); System.out.println("result:" + (6 + 6)); int i = 6 + 6; System.out.println(i); System.out.println(i + 6); System.out.println("result is:" + i + 6); System.out.println("result is:" + 6 + 6); short a = 128; byte b = (byte) a; System.out.println("result is:" + a); System.out.println("result is:" + b); short c = 132; byte d1 = (byte) c; System.out.println("result is:" + c); System.out.println("result is:" + d1);
run result: false false true true result:12 12 18 result is:126 result is:66 result is:128 result is:-128 result is:132 result is:-124
String a="hello"; String b="hello"; String d="hello"; char[] c={'h','e','l','l','o'}; String s1="hello" +"1"; String s2 ="hello"+"1"; String s3 = new String("hello1"); System.out.println(a==b); System.out.println(a.equals(b)); System.out.println(a.equals(c)); System.out.println(a.equals(new String("hello"))); System.out.println(s1==s2); System.out.println(s1==s3); System.out.println(s1.equals(s3));
} }
true
true
false
true
true
false
true
f==d incompatible operand types Float and Double
System.out.println("result is:" + 6 +++ 6); invalid argument to operation ++/--
2.
抽象类不能是final
抽象方法也不能是final,在接口中报显示:Illegal modifier for the interface method getMethod; only public & abstract are permitted
在抽象类中显示:The abstract method getMethod in type AbstractTest can only set a visibility modifier, one of public or protected
抽象方法不可以是private
抽象方法不可以是static,在抽象类中显示:The abstract method getMethod in type AbstractTest can only set a visibility modifier, one of public or protected.在接口中显示Remove invalid parameters
抽象方法只能放在抽象类中是错误的,还可以放在接口中
抽象方法在接口和类中都可以抛出异常,但子类或实现类要对异常进行处理
public abstract class AbstractTest {
public abstract int getMethod()throws Exception;
public abstract int getInt();
}
public interface InterfaceTest {
public int getMethod()throws Exception;
}
map and hashmap difference
map是接口,不能用new出对象
hashmap是继承map接口的实现类,可以new出对象,HashMap实现了接口Map,就是说HashMap实现了Map所有的方法
具体介绍
Map提供key到value的映射。一个Map中不能包含相同的key,每个key只能映射一个 value。HashMap是实现了Map接口的具体类.HashMap是采用key的hashCode分组而实现的一种Map。
HashMap的特点是查找速度快,缺点是不能保证迭代的顺序
3.
look at the following code, one variable "x" given, write a code segment;if the result is that x equals an even number,javaScript code will hide following HTML table
<div id="testVisiblitity">
<table border="1">
<tr>
<td>row 1,cell 1</td>
<td>row 2,cell 2</td>
</tr>
</table>
</div>
answer:
<script src="jquery-1.7.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
if(x % 2 == 1){
$("#testVisiblitity").hide();
}else{
$("#testVisiblitity").show();
}
});
</script>
4.look at the following snippet,write code to perform the following 3 validations
make sure these two fields are required ,otherwise alert user message and stop
make sure these two fields are date format(such as'mm/dd/yyyy"), otherwise alert user message and stop
make sure "to_date" is larger than "from_date"
<html>
<form method="POST" name="form1" action="action1">
From Date <input type="text" name="from_date" size="10"/></br>
To Date <input type="text" name="to_date" size="10"/></br>
</form>
</html>
the second dont know how to validate, others validate as follow, any issue, please inform me
<script type="text/javascript src="jquery-1.7.2.min.js"/>
<script type="text/javascript">
$(document).ready(function(){
var fromDateParam = document.getElementById("from_date");
var fromDate = $.trim(fromDateParam.value);
var toDateParam = document.getElementById("to_date");
var toDate = $.trim(toDateParam.value);
if(fromDate==null||fromDate==''){
alert("input from date is null");
return;
}
if(toDate==null||toDate==''){
alert("input to date is null");
return;
}
Pattern pattern = new Pattern();
java.text.SimpleDateFormat dateFormat = new java.text.SimpleDateFormat("MM/dd/yyyy");
Date fromDateFormat = dateFormat.parse(form.get("from_date"));
Date toDateFormat = dateFormat.parse(form.get("to_date"));
Boolean isNotPastDate = toDateFormat.compareTo(fromDateFormat)>=0;
if(!isNotPastDate){
alert("to date must be larger than from date, please full it again");
return;
}
});
</script>
5.InputStream in = new InputStream(); wrong, because Cannot instantiate the type InputStream
6.float a1 =1.0f;
double a2=1.0;
float a3=1.0;编译出错Type mismatch: cannot convert from double to float
Float a4= new Float(1.0);
相关推荐
- **北京、深圳、南京、沈阳、长沙、上海、杭州** 的笔试时间为 **2011年10月15日**。 - **天津、厦门、香港** 的笔试时间为 **2011年10月22日**。 ### 宣讲会时间及地点 #### 宣讲会剩余时刻表: - **重庆邮电...
腾讯2012年的校园招聘笔试在全国多个城市举行,包括合肥、重庆、大连、武汉、北京、深圳、南京、沈阳、长沙、上海、杭州、天津、厦门和香港。具体时间安排如下: - 合肥、重庆、大连、武汉:10月9日 - 北京、深圳、...
嵌入式八股文面试题库资料知识宝典-华为的面试试题.zip
训练导控系统设计.pdf
嵌入式八股文面试题库资料知识宝典-网络编程.zip
人脸转正GAN模型的高效压缩.pdf
少儿编程scratch项目源代码文件案例素材-几何冲刺 转瞬即逝.zip
少儿编程scratch项目源代码文件案例素材-鸡蛋.zip
嵌入式系统_USB设备枚举与HID通信_CH559单片机USB主机键盘鼠标复合设备控制_基于CH559单片机的USB主机模式设备枚举与键盘鼠标数据收发系统支持复合设备识别与HID
嵌入式八股文面试题库资料知识宝典-linux常见面试题.zip
面向智慧工地的压力机在线数据的预警应用开发.pdf
基于Unity3D的鱼类运动行为可视化研究.pdf
少儿编程scratch项目源代码文件案例素材-霍格沃茨魔法学校.zip
少儿编程scratch项目源代码文件案例素材-金币冲刺.zip
内容概要:本文深入探讨了HarmonyOS编译构建子系统的作用及其技术细节。作为鸿蒙操作系统背后的关键技术之一,编译构建子系统通过GN和Ninja工具实现了高效的源代码到机器代码的转换,确保了系统的稳定性和性能优化。该系统不仅支持多系统版本构建、芯片厂商定制,还具备强大的调试与维护能力。其高效编译速度、灵活性和可扩展性使其在华为设备和其他智能终端中发挥了重要作用。文章还比较了HarmonyOS编译构建子系统与安卓和iOS编译系统的异同,并展望了其未来的发展趋势和技术演进方向。; 适合人群:对操作系统底层技术感兴趣的开发者、工程师和技术爱好者。; 使用场景及目标:①了解HarmonyOS编译构建子系统的基本概念和工作原理;②掌握其在不同设备上的应用和优化策略;③对比HarmonyOS与安卓、iOS编译系统的差异;④探索其未来发展方向和技术演进路径。; 其他说明:本文详细介绍了HarmonyOS编译构建子系统的架构设计、核心功能和实际应用案例,强调了其在万物互联时代的重要性和潜力。阅读时建议重点关注编译构建子系统的独特优势及其对鸿蒙生态系统的深远影响。
嵌入式八股文面试题库资料知识宝典-奇虎360 2015校园招聘C++研发工程师笔试题.zip
嵌入式八股文面试题库资料知识宝典-腾讯2014校园招聘C语言笔试题(附答案).zip
双种群变异策略改进RWCE算法优化换热网络.pdf
内容概要:本文详细介绍了基于瞬时无功功率理论的三电平有源电力滤波器(APF)仿真研究。主要内容涵盖并联型APF的工作原理、三相三电平NPC结构、谐波检测方法(ipiq)、双闭环控制策略(电压外环+电流内环PI控制)以及SVPWM矢量调制技术。仿真结果显示,在APF投入前后,电网电流THD从21.9%降至3.77%,显著提高了电能质量。 适用人群:从事电力系统研究、电力电子技术开发的专业人士,尤其是对有源电力滤波器及其仿真感兴趣的工程师和技术人员。 使用场景及目标:适用于需要解决电力系统中谐波污染和无功补偿问题的研究项目。目标是通过仿真验证APF的有效性和可行性,优化电力系统的电能质量。 其他说明:文中提到的仿真模型涉及多个关键模块,如三相交流电压模块、非线性负载、信号采集模块、LC滤波器模块等,这些模块的设计和协同工作对于实现良好的谐波抑制和无功补偿至关重要。
内容概要:本文探讨了在工业自动化和物联网交汇背景下,构建OPC DA转MQTT网关软件的需求及其具体实现方法。文中详细介绍了如何利用Python编程语言及相关库(如OpenOPC用于读取OPC DA数据,paho-mqtt用于MQTT消息传递),完成从OPC DA数据解析、格式转换到最终通过MQTT协议发布数据的关键步骤。此外,还讨论了针对不良网络环境下数据传输优化措施以及后续测试验证过程。 适合人群:从事工业自动化系统集成、物联网项目开发的技术人员,特别是那些希望提升跨协议数据交换能力的专业人士。 使用场景及目标:适用于需要在不同通信协议间建立高效稳定的数据通道的应用场合,比如制造业生产线监控、远程设备管理等。主要目的是克服传统有线网络限制,实现在不稳定无线网络条件下仍能保持良好性能的数据传输。 其他说明:文中提供了具体的代码片段帮助理解整个流程,并强调了实际部署过程中可能遇到的问题及解决方案。