下列程序执行之后,将输出 public class exl9 { public static void main(string[] args) { int x=3; int y=7; switch(y/x){ case 1: y*=2; break; case 2: y*=3; break; case 3: y*=4; break; default: y=0; } System.out.print(y); } }
A.28
B.21
C.14
D.0
第1题:
将下面程序补充完整。
include <iostream>
using namespace std;
class Base{
public:
【 】 fun(){return 0;} //声明虚函数
};
class Derived:public Base{
public:
x,y;
void SetVal(int a,int b){}
int fun(){return x+y;}
};
void 【 】 SetVal(int a,int b){x=a;y=b;} //类Derived成员函数
void main(){
Derived d;
cout<<d.fun()<<endl;
}
第2题:
执行下列程序段之后,输出的结果为______。 public class ex41 { public static void main(string[] args) { int x=15; byte y=1; x>>=y++; System.out.println(x); } }
A.3
B.7
C.14
D.10
第3题:
第4题:
I use jdt(Ver=3.6.2.v_A76_R36x, API=JSL3) to generate a member method or field
I find the output method has no modifiers. setModifier(int) is @Deprecated,
So I use setFlag(int) method.I tried parameter Modifier.PUBLIC, Modifier.ModifierKeyword.PUBLIC_KEYWORD.toFlagValue(), neither works.
Code:
MethodDeclaration md = ast.newMethodDeclaration();
md.setFlags(Modifier.ModifierKeyword.PUBLIC_KEYWORD.toFlagValue());
md.setReturnType2(ast.newPrimitiveType(PrimitiveType.VOID));
// md.setFlags(Modifier.PUBLIC | Modifier.STATIC);
md.setName(ast.newSimpleName("onCreate"));
Output:
void onCreate( ...
Question:
Where public keyword gone? how to add modifier? why ? or a Bug?
装jdk和eclipse,把jdk配置到eclipse里就可以的。
第5题: