下面程序代码运行结果为( )。 import java.awt.*; public class Test { public static void main (String args[]) { String s1="a+b+c"; String s2="+"; int i=s1.lastIndexOf (s2); System.out.println(i); } }
A.0
B.1
C.2
D.3
第1题:
下列程序的运行结果是______。
include<iostream.h>
class test
{
private:
int hum;
public:
test( );
int TEST( ){return num+100;)
~test( );
};
test::test( ){num=0;)
test::~test( ){cout<<"Destructor is active"<<endl;)
void main( )
{
test x[3];
cout<<x[1].TEST( )<<endl;
}
第2题:
下面程序的运行结果为
#include<iostream. h>
class A
{
public:
A( ) {cout < <"1";}
~A( ) {cout < <"2";}
};
class B:public A
{
public:
B( ) {cout < <"3";}
~B( ) {cout < <"4";}
};
void main( )
{
B b;
}
A.1234
B.1324
C.1342
D.3142
第3题:
下面程序的运行结果为 #include<iostream,h> class A { public: A(){cout<<"1";} ~A(){cout<<"2";} }; Class B:public A { public: B(){cout<<"3";} ~B(){cout<<"4";} }; void main() { B b; }
A.1234
B.1324
C.1342
D.3142
第4题:
下列程序的运行结果是______。
include<iostream.h>
class Base
{
public:
void f(int x){cout<<“Base:”<<x<<endl;}
);
class Derived:public Base
{
public:
void f(char*str){cout<<“Derived:”<<str<<endl;}
};
void main(void)
{
Base*pd=ne
第5题:
下面程序的运行结果为 #include<iostream.h> class A { public: A( ){cout<<"1";} ~A( ){cout<<"2";} }; class B:public A { public: B( ){cout<"3";} ~B( ){cout<<"4";} }; void main( ) { B
A.1234
B.1324
C.1342
D.3142
第6题: