1. 两个整数如何不经过第三方变量进行替换。
2. If(x>4) then print( “Test1”);
Else if(x<9) then print (“test2”);
Else print(“tese3”);
如何让它输出 test2 ___
A:Less than 0 B: Less then 4 C: between 4 and 9 Dgreater than 9 E: none
3. 按规律填空 2,3,7,22,155,____
4. What is the default type of access control symbol in the Actionscript 3.0?
5. 写出下列程序的运行结果并解释。
class A
{
int i = 1;
public A()
{
i = 2;
}
public void print()
{
System.out.println("the result of A is" + i);
}
}
class B extends A
{
private i = 3;
public B()
{
i = 4;
}
public void print()
{
System.out.println("the result of B is" + i);
}
}
public class Test
{
pulbic static void main(String [] args)
{
A a = new B();
a.print();
}
}
6.列举至少5种排序的方法
7.进程间通讯有哪几种方式
8.面向对象语言有哪几个特征
9.当编译下列程序时会发生什么?说出理由
public abstract class Test
{
private abstract String doSomethingA()
private static abstract String doSomethingB()
public String doSomethingC()
}
10.写出一个函数去除一个已经排好序的数组中重复的数
11.Actionscript3.0中强制类型转换的两种写法
有装满药片的5个广口瓶,其中一个瓶子的药片已经被污染。没污染的药每片10gm,被污染的每片9pm。给你一个天平,如何只经 过一次测量找出被污染的药瓶。
12.写一个程序打印出一个文件夹中所有文件的文件名(包括子文件夹中的文件)
下列方法可能被用到
File file
file.isFile()
file.listFiles()
注意编码风格
2. If(x>4) then print( “Test1”);
Else if(x<9) then print (“test2”);
Else print(“tese3”);
如何让它输出 test2 ___
A:Less than 0 B: Less then 4 C: between 4 and 9 Dgreater than 9 E: none
3. 按规律填空 2,3,7,22,155,____
4. What is the default type of access control symbol in the Actionscript 3.0?
5. 写出下列程序的运行结果并解释。
class A
{
int i = 1;
public A()
{
i = 2;
}
public void print()
{
System.out.println("the result of A is" + i);
}
}
class B extends A
{
private i = 3;
public B()
{
i = 4;
}
public void print()
{
System.out.println("the result of B is" + i);
}
}
public class Test
{
pulbic static void main(String [] args)
{
A a = new B();
a.print();
}
}
6.列举至少5种排序的方法
7.进程间通讯有哪几种方式
8.面向对象语言有哪几个特征
9.当编译下列程序时会发生什么?说出理由
public abstract class Test
{
private abstract String doSomethingA()
private static abstract String doSomethingB()
public String doSomethingC()
}
10.写出一个函数去除一个已经排好序的数组中重复的数
11.Actionscript3.0中强制类型转换的两种写法
有装满药片的5个广口瓶,其中一个瓶子的药片已经被污染。没污染的药每片10gm,被污染的每片9pm。给你一个天平,如何只经 过一次测量找出被污染的药瓶。
12.写一个程序打印出一个文件夹中所有文件的文件名(包括子文件夹中的文件)
下列方法可能被用到
File file
file.isFile()
file.listFiles()
注意编码风格
解决方案 »
- 关于jdk
- 内部类几个概念的理解问题
- 怎样才能学好java我是初学者请大侠提点建议
- Java经典面试题!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- 在java里面怎样可以象c++那样用cin>>?
- 新手提问:jbuilder问题!
- 那位基于Ericsson提供的资料开发过MMS相关的程序??
- 如何和浏览器产生一个socket通讯???我还是没有解决 希望大家再帮帮忙
- ++++++新来的。问一:大家都用JAVA的什么编译环境(比如C++有人用VC++,有人用BC++)?+++++
- [简单java题求解]
- java TCP 编程,读取一个永不断开InputStream,怎样保证数据完整,不断开流,并且把数据处理好?
- 用JButton按钮退出对话框JDialog
第三题:前一个数乘以后一个数+1
因为我觉得变量应该是在编译期间静态绑定,而方法是在运行程序时候动态绑定。
但结果是the result of B is 4
期望高手赐教。
public static void main(String[] args){ BigDecimal k= new BigDecimal(55555555);
BigDecimal n= new BigDecimal(66666666);
k=k.add(n);
n=k.subtract(n);
k=k.subtract(n);
System.out.println(k);
System.out.println(n);
}
另:Actionscript3.0 是什么东东?哪位达人解答一下。
用异或运算效率最高a=a^b;
b=a^b;
a=a^b;
用异或运算效率最高 a=a^b;
b=a^b;
a=a^b;
关于第一题:是的,用x=x+y;y=x-y;x=y; 想法可以。但是要用异或,原因大家比我熟悉,加法设级到微指令多。异或少。这样当然异或运行快。同理为什么我们要用移位运算,而且不用乘2或则2的倍数类似的操作。很简单移位运算快啊。
再说第五题:怎么也不能等于2.因为new的是class B对象。也就是说当你在实例化对象的时候解释器是从下往上扫描够造函数,从上往下开始调用构造函数。
也就是说class A 的构造函数肯定被调用。同时class B的也被调用了。所以这时i已经是4了。而且 类A中的i在类B中也被隐藏。想看到你们的2吗。好我给你输出来。
只要你的答题中有实例变量被隐藏这句话。考官应在这个题不要为难你了(个人意见)
时间关系,不对的地方各位批评指出。还有感觉楼主在打程序的时候打错了比如 private i=3 所以我小改了一下。class A
{
int i = 1;
public A()
{
i = 2;
}
public void print()
{
System.out.println("the result of A is" + i);
}
}
class B extends A
{
private int i= 3;
public B()
{
i = 4;
}
public void print()
{
System.out.println("the number of i is:" + i);
System.out.println("the result of i is:" +super.i);
}
}
public class Test
{
public static void main(String [] args)
{
A a = new B();
a.print();
}
}
public class Test2{
public static void main(String args[]){
int int1=2;
int int2=4;
int2=int1^int2;
int1=int2^int1;
int2=int2^int1;
System.out.println("The number of the int1 is:"+int1);
System.out.println("The number of the int2 is:"+int2);
}
}
File file = new File("d:/chat1.0");
File[] fileList = file.listFiles();
listFiles(fileList);
}
private static void listFiles(File[] fileList){
for(File fileTemp :fileList){
if(fileTemp.isFile()){
System.out.println(fileTemp.getName());
}else {
File[] list =fileTemp.listFiles();
listFiles(list);
}
}
}
}
int j=2;
i=i+j;
j=i-j;
i=i-j;
第一题错了
x=x+y;y=x-y;x=x-y;
带答案, 部分公司的面试流程也在里面. 大家可以研究研究. 这些公司其中大多数的招聘职位都是对
java软件工程师的招聘职位. 笔试测试范围基本在java基础 和j2ee部分. 为方便浏览 分类贴到一招聘网
站的面试宝典的栏目里面了.
http://www.javajob.cn/Info/Info_List.stm?Param=41
带答案, 部分公司的面试流程也在里面. 大家可以研究研究. 这些公司其中大多数的招聘职位都是对
java软件工程师的招聘职位. 笔试测试范围基本在java基础 和j2ee部分. 为方便浏览 分类贴到一招聘网
站的面试宝典的栏目里面了.
http://www.javajob.cn/Info/Info_List.stm?Param=41