1.程序执行结果是什么.
publicclass Encapsulation {
class ClassValue{
publicinti=15;
}
publicstaticvoid main<String[] args> {
// TODO Auto-generated method stub
Encapsulation t=new Encapsulation<>;
t.first<>;
}
publicvoid first<>{
ClassValue cv=new ClassValue<>;
second<cv>;
System.out.println<"cv.i:"+cv.i>;
}
publicvoid second<ClassValue v>{
ClassValue cv=new ClassValue<>;
v.i=25;
v=cv;
System.out.println<"v.i:"+v.i>;
}
}
2.程序输出结果是什么
class A {
publicvoid show<> {
System.out.println<"class a show ">;
}
}
class B extends A {
publicvoid show<> {
System.out.println<"class a show ">;
}
}
publicclass Inherit {
/**
* param args
*/
publicstaticvoid main<String[] args> {
A a = new B<>;
sort out同义短语if <a instanceof A> {
System.out.println<"A ">;
}
if <a instanceof B> {
System.out.println<"B ">;
}
}
}
3.程序输出结果是什么
publicclass Polymorphic {
/**
* param args
*/
publicstaticvoid main<String[] args> {
// TODO Auto-generated method stub
Parent pare = new Sub<>;
pare.show<>;
}
}
class Parent {
publicvoid show<> {
System.out.println<"class Parent show ">;
}
}
class Sub extends Parent {
publicvoid show<> {
System.out.println<"class Sub show ">;
}
}
4.程序输出结果是什么
publicclass tryCatch {
/**
* param args
*/
publicstaticvoid main<String[] args> {
try {
System.out.println<"begin ">;
System.out.println<"end ">;
return;
} catch <Exception e> {
System.out.println<"excepton ">;
} finally {
System.out.println<"finally">;
}
}
}
5.对一个整型数组进行排序
publicclass MySort {
publicstaticvoid main<String[] args> {
MySort sort = new MySort<>;
int[] arr = newint[] { 3, 22, 11, 5, 400, 99, 20, 22, 5 };
sort.sort<arr>;
for <int i : arr> {
System.out.print<i + ",">;
}
}
publicvoid sort<int[] targetArr> {// 小到大的排序
int temp = 0;
for <int i = 0; i < targetArr.length; i++> {
for <int j = i; j < targetArr.length; j++> {
if <targetArr[i] < targetArr[j]> {
// 方法一:
temp = targetArr[i];
targetArr[i] = targetArr[j];
targetArr[j] = temp;
/*
* /方法二: targetArr[i] = targetArr[i] + targetArr[j];
* targetArr[j] = targetArr[i] - targetArr[j]; targetArr[i]
* = targetArr[i] - targetArr[j];
*/
// 方法三:
// targetArr[i] = targetArr[i]^targetArr[j];
// targetArr[j] = targetArr[i]^targetArr[j];
// targetArr[i] = targetArr[i]^targetArr[j];
}
}
}
}
}
6.sql题目
有两X表student,和scope
Student:学号,##,性别,年龄
Scope:学号,语文,数学,英语
1.查询X三的学号,##,性别, 语文,数学,英语
2.查询语文比数学好的同学
3.查处##相同的学生学号
7.画出客户网上买书的实体关系图,并且查出交易金额最大的客户.
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论