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);
相关推荐
超级清晰上海张江地图,超级清晰上海张江高科地图,张江地图
上海张江高科技园区是上海乃至全国的重要科技创新中心,随着园区的发展,交通问题逐渐凸显,特别是交通拥堵问题,已经成为影响园区效率和居民生活质量的关键因素。基于大数据的交通拥堵治理方法研究,旨在利用现代...
本文聚焦于上海张江高科园区的交通拥堵问题,并基于大数据技术提出解决方案。大数据技术在近年来的飞速发展为城市交通缓堵治理带来了新的手段,文章通过分析大数据得出了一些成果,并致力于提升城市区域交通效率以及...
【标题】:惠瑞捷半导体科技公司落户上海张江,引领半导体行业技术创新 【描述】:全球领先的半导体测试公司惠瑞捷宣布其在中国的分支机构——惠瑞捷半导体科技(上海)有限公司在上海张江高科技园区正式成立,标志...
很抱歉,根据您提供的信息,这个压缩包"城市设计资料-阅 相当好上海张江新希望总部基地.rar"似乎包含的是关于城市设计,特别是上海张江新希望总部基地的相关资料,而不是IT行业的具体内容。标签"数据"可能指的是设计...
中国上海浦东张江作为国内外知名的科技产业集聚区,正在迎来新的发展机遇。在这一背景下,世联地产顾问公司针对张江光电子产业园的发展,提出了前期策划方案,旨在通过深入研究、科学规划和创新思维,为该园区打造一...
惠瑞捷半导体科技公司,作为一家全球领先的科技企业,于2006年11月29日正式在上海市张江高科技园区设立分支机构——惠瑞捷半导体科技(上海)有限公司,此举标志着该公司对中国经济特别是半导体行业的深度参与和长期...
【上海张江高新技术产业开发区普陀园管理委员会2019招聘模拟试题及答案解析】 这份文档内容涉及了多个知识领域,主要与管理和法律相关,同时也涵盖了经济、刑事责任和健康常识。以下是这些知识点的详细说明: 1. *...
本设计源码提供了一个基于HTML和CSS的上海民办张江集团学校2022届8班网站,包含141个文件,其中包括70张webp图片,19张jpg图片,17个html页面文件,13个css样式文件,12个js脚本文件,6个png图片文件,1个LICENSE...
* 公司类型:上海张江高科技园区开发股份有限公司 二、公司主要业务 * 张江科学城的重要开发主体 * 积极响应国家战略机遇,积极对接全球创新资源 * 加速集聚全球创新要素,激活创新生态圈的活力 * 强化科学城的...
标题中提到的“浦东人工智能风云再起”和“张江发布人工智能集聚区”指向了中国上海浦东新区张江地区在人工智能领域的快速发展与集聚区建设。张江,作为浦东新区乃至上海市的高新技术产业开发区,一直是科技企业和...
【张江高科2020年半年度报告】揭示了上海张江高科技园区开发股份有限公司在该时期的运营状况和财务表现。这份报告是企业向公众披露其业务进展、财务健康状况以及潜在风险的重要文件。 1. **董事会与监事会的责任...
1. WHAT'S NEW FOR ADMIN 2. BUSINESS RESILIENCY WITH IBM TOOLS 3. UTILITY ENHANCEMENTS 4. SQL WORKSHOP 5. SPACIAL DB SUPPORT 6. PARALLISM AND ZIIP 7. OPTIMIZER ENHANCEMENT 8. MEMORY MANAGEMENT ...
复旦张江生物医药股份有限公司首次公开发行股票并在科创板上市的招股说明书详细披露了本次发行的各个环节,为潜在的投资者提供了重要的决策参考。以下是对该招股说明书中主要内容的深度解析: **科创板上市背景及...
【标题】中的“城市设计资料-阅相当好上海张江新希望总部基地”指的是一个关于城市设计项目的研究或设计方案,具体聚焦于上海张江地区的“新希望总部基地”。这个项目可能涉及新希望集团在上海张江高科技园区内的...
- **矢量公交线网**:通过互联网抓取如高德、百度等平台的数据,获取上海市域内的轨道线路和公交线路站点信息,包括3280条双向线路和68327万个站点,用于数据处理、运算和可视化展示。 - **公交IC卡和GPS数据**...
【张江高科深度报告】聚焦于上海张江高科这一独特的科技园区开发商,该公司的核心业务在于产业地产运营和高科技产业整合,并提供科技金融集成服务。张江高科是浦东新区直属的国有控股上市公司,同时也是张江科学城的...
在当前中国创新驱动发展的大背景下,上海张江国家自主创新示范区作为高科技产业发展的桥头堡,对于激励企业创新和促进科技成果转化,具有不可替代的作用。为此,大张江创新资金应运而生,成为推动区域内企业发展的...
张江人工智能岛是中国上海市的一个人工智能应用示范园区,也是国内首个“AI+社区”的实施载体。该园区致力于上海人工智能创新应用先导区的建设,对接AI企业,打造全场景、沉浸式服务体验,聚集了大量人工智能企业的...
该方案基于对上海甲级商务楼市场的深入研究,特别是对张江大厦周边同质化商务楼市场的分析,以制定有效的营销和广告策略。 首先,市场简析部分指出,上海甲级商务楼市场在2003年呈现上升趋势,平均出租率从65%升至...