下列程序的输出结果是 class Test{ public static void main(String args[]){ int n=7; n<<=3; n=n&n+1|n+2^n+3; n>>=2; System.out.println(n); } }
A.0
B.-1
C.14
D.64
第1题:
有如下程序: #inelude<iostream> usingnamespacestd; classTest { public: Test(){n+=2;} ~Test(){n-=3;} staticintgetNum(){returnn;} private: staticintn; }; intTest::n=1; intmain()
Test*P=newTest: deleteP; cout<<"n="<<Test::getNum()<<endl; return0; } 执行后的输出结果是( )。
A.n=0
B.n=1
C.n=2
D.n=3
第2题:
有如下程序: #include<iostream> usingnamespacestd; classTest { public: Test(){n+=2;} ~Test(){n-=3;} staticintgetNum(){returnn;} private: staticintn; }; intTest::n=1; intmain() { Test*p=neWTest; deletep;
cout<<"n="<<Test::getNum()<<endl; return0; } 执行该程序的输出结果是( )。
A.n=0
B.n=1
C.n=2
D.n=3
第3题:
有如下程序:
#include<iostream>
usingnamespacestd;
classTest
{
public:
Test(){n+=2;}
~Test(){n-=3;}
staticintgetNum(){returnn;}
private:
staticintn;
};
intTest::n=1;
intmain()
{
Test*p=neWTest;
deletep;
cout<<"n="<<Test::getNum()<<endl;
return0;
}
执行该程序的输出结果是( )。
A.n=0
B.n=1
C.n=2
D.n=3
第4题:
有如下程序: #include <iostream> using namespace std; class Test { public: Test() {n+=2; } ~Test() {n-=3; } static int getNum() {return n; } private: static int n; }; int Test::n=1; int main() { Test* p=new Test; delete p; cout<<"n="<<Test::getNum()<<endl; return 0; } 执行该程序的输出结果是( )。
A.n=0
B.n=1
C.n=2
D.n=3
第5题:
有如下程序: #include <iostream> using namespace std; class Test { public: Test() {n+=2;} ~Test() {n-=3;} static int getNum(){retum n;} private: static int n; }; int Test:: n=1; int main() { Test*p=new Test; delete p; cout<<"n="<<Test:: getNum()<<end1; return 0; };执行后的输出结果是______.
A.n=0
B.n=1
C.n=2
D.n=3
第6题: