java笔试题
来源:互联网 发布:网络犯罪案例分析 编辑:程序博客网 时间:2024/04/19 03:14
1.
public class TT {
public static void main(String[] args) {
String a = "A";
StringBuffer b = new StringBuffer("B");
StringBuffer c = new StringBuffer("C");
change(a,b,c);
System.out.println(a+","+b+","+c);
}
static void change(String s,StringBuffer s1,StringBuffer s2){
s= s+"1";
s1.append("1");
s2 = new StringBuffer("c1");
}
A: A,B1,C
B: A1,B1,C1
C: A,B,C
2.
class Tree{
void say(){}
}
class Point extends Tree{
void say(){
System.out.println("point");
}
}
class What extends Tree{
void say(){
System.out.println("what");
}
}
class Test{
static void aa(Tree t){
t.say();
}
public static void main(String[] args) {
Tree point = new Point();
Tree what = new What();
aa(point);
aa(what);
}
}
A:point
B:what
C:什么都不输出
D:编译不能通过
3:写出该程序运行后控制台的输出
public class TestString{
public static void callA(int a,StringBuffer sb){
a = 10;
sb.append(" luck");
print(a,sb);
}
public static void callB(int a,StringBuffer sb){
a = 33;
sb = new StringBuffer("haha");
print(a,sb);
}
public static void print(int a,StringBuffer sb){
System.out.println(a);
System.out.println(sb.toString());
}
public static void main(String[] args) {
int a = 100;
StringBuffer sb = new StringBuffer("GOOD");
TestString.callA(a,sb);
TestString.callB(a,sb);
print(a,sb);
}
}
4:写出该程序运行后控制台的输出
class Parent{
Parent(){
System.out.println("Parent构造方法");
}
static{
System.out.println("Parent static");
}
}
class Child extends Parent{
Child(){
System.out.println("Child构造方法");
}
static{
System.out.println("Child static");
}
}
public class TestCons {
public static void main(String[] args) {
Parent chi = new Child();
}
}
public class TT {
public static void main(String[] args) {
String a = "A";
StringBuffer b = new StringBuffer("B");
StringBuffer c = new StringBuffer("C");
change(a,b,c);
System.out.println(a+","+b+","+c);
}
static void change(String s,StringBuffer s1,StringBuffer s2){
s= s+"1";
s1.append("1");
s2 = new StringBuffer("c1");
}
A: A,B1,C
B: A1,B1,C1
C: A,B,C
2.
class Tree{
void say(){}
}
class Point extends Tree{
void say(){
System.out.println("point");
}
}
class What extends Tree{
void say(){
System.out.println("what");
}
}
class Test{
static void aa(Tree t){
t.say();
}
public static void main(String[] args) {
Tree point = new Point();
Tree what = new What();
aa(point);
aa(what);
}
}
A:point
B:what
C:什么都不输出
D:编译不能通过
3:写出该程序运行后控制台的输出
public class TestString{
public static void callA(int a,StringBuffer sb){
a = 10;
sb.append(" luck");
print(a,sb);
}
public static void callB(int a,StringBuffer sb){
a = 33;
sb = new StringBuffer("haha");
print(a,sb);
}
public static void print(int a,StringBuffer sb){
System.out.println(a);
System.out.println(sb.toString());
}
public static void main(String[] args) {
int a = 100;
StringBuffer sb = new StringBuffer("GOOD");
TestString.callA(a,sb);
TestString.callB(a,sb);
print(a,sb);
}
}
4:写出该程序运行后控制台的输出
class Parent{
Parent(){
System.out.println("Parent构造方法");
}
static{
System.out.println("Parent static");
}
}
class Child extends Parent{
Child(){
System.out.println("Child构造方法");
}
static{
System.out.println("Child static");
}
}
public class TestCons {
public static void main(String[] args) {
Parent chi = new Child();
}
}
- 华为Java笔试题笔试
- java笔试题
- java笔试题
- Java笔试题
- java经典笔试题
- 一JAVA笔试题
- Java笔试题集锦
- JAVA笔试题
- java笔试题大全
- 一道java笔试题
- JAVA笔试题
- Java笔试题
- Java笔试题总结
- JAVA笔试改错题
- 华为JAVA笔试题
- java笔试题
- Java笔试题一份
- 常见java笔试题。。。
- DECODE()函数
- 240多个jQuery插件
- 在美国工作十多年,经历了很多裁员事件。有些心得可以分享ZZ
- Micro-X by eXPerience
- 准备开发一个教学用的操作系统
- java笔试题
- 2个视频,安全带和安全气囊比较;民工超牛模仿杰克逊舞蹈 差点被保安拎走
- AES_ctr128
- 信尔杰公司面试题
- 俗人理解的事件和委托
- 访问WEB-INF下的jsp页面
- 字符设备文件的打开
- 我的博客访问的人为什么很少
- 在windows下用u盘安装ubuntu8.04