在JSP页面中,下列( )代码能够正确的声明计算乘法的方法。
A: <;%!Public int mul(int x,int y){Return x*y ;}%>;
B: <;%=public int mul(int x,int y){Return x*y ;}%>;
C: <;%public int mul(int x,int y){%>;<;% returnx*y ;%>;<;%}%>;
D: <;%Public int mul(int x,int y){Return x*y ;}%>;
A: <;%!Public int mul(int x,int y){Return x*y ;}%>;
B: <;%=public int mul(int x,int y){Return x*y ;}%>;
C: <;%public int mul(int x,int y){%>;<;% returnx*y ;%>;<;%}%>;
D: <;%Public int mul(int x,int y){Return x*y ;}%>;
举一反三
- 下面类的索引定义或使用正确的是()。 A: class MyClass{ int x; int y; public int this[int index] { get{ if (index==0) return x; else return y; }}} B: class MyClass{ int x; int y; public int this[int index] { set{ if (index==0) x=value; else y=value; }}} C: class MyClass{ int x; int y; public int INDEX[int index] { get{ if (index==0) return x; else return y; } set{ if (index==0) x=value; else y=value; }}} D: class MyClass{ int x; int y; public int this[int index] { get{ if (index==0) return x; else return y; } set{ if (index==0) x=value; else y=value; }}}
- 不能与该方法构成重载的方法是() public double fun(int x,double y){ return x + y; } A: public void fun(int x){ System.out.println("x * x="+(x*x)); } B: public void fun(int a, double b){ System.out.println("a +b ="+(a+b)); } C: public int fun(int x, int y,int z){ renturn (x+y+z); } D: public double fun(double x, int y){ return x * y ; }
- class A { public int f(int x,int y) { return x+y; } } class B extends A { public int f(byte x,int y) { return x*y; } } 子类B的对象只能调用子类中的f方法。( )
- 以下是"public static void test(int x, int y)"的方法重载( ) A: public static void Test(int x) B: public static int test(int x, int y) C: public static void test(int y, int x) D: public static void test(int x, int y)
- 下列函数定义不正确的是( )。 A: int max() {int x,y,z; z=x>y?x:y; return z;} B: int max(x,y){ int z; z=x>y?x:y; return z;} C: int max(){ } D: int max(int x,int y) {int z; z=x>y?x:y; return(z);}