单选题A public member vairable called MAX_LENGTH which is int type, the value of the variable remains constant value 100. Use a short statement to define the variable.()A public int MAX_LENGTH=100;B final int MAX_LENGTH=100;C final public int MAX_LENGTH=100;D public final int MAX_LENGTH=100;

单选题
A public member vairable called MAX_LENGTH which is int type, the value of the variable remains constant value 100. Use a short statement to define the variable.()
A

 public int MAX_LENGTH=100;

B

 final int MAX_LENGTH=100;

C

 final public int MAX_LENGTH=100;

D

 public final int MAX_LENGTH=100;


参考解析

解析: Java中共有变量使用public定义,常量变量使用final,另外注意的是修饰符的顺序,一个最完整的修饰是public static final int varial_a=100;这个顺序不能错,这和c++中也是 不同的。而答案c恰恰错在修饰符的顺序上。

相关考题:

有如下程序: include using namespace std; class Monitor{ public: Monitor(cha 有如下程序:include<iostream>using namespace std;class Monitor{public:Monitor(char t):type(t){ }void Print( )const{cout<<"The type of monitor is"<<type private:char type;};class Computer{public:Computer(int i,char C) :______{}void Print( )const{eout<<"The computer is"<<id<<endl;mort.Print( );}private:int id;Monitor mon;};int main( ){const Computer myComputer(101,'B');myComputer.Print( );return 0;}请将程序补充完整,使程序在运行时输出:The computer is 101The type of monitor is B

已知如下类定义: class Base { public Base (){ //... } public Base ( int m ){ //... } protected void fun( int n ){ //... } } public class Child extends Base{ // member methods } 如下哪句可以正确地加入子类中?() A.private void fun( int n ){ //...}B.void fun ( int n ){ //... }C.protected void fun ( int n ) { //... }D.public void fun ( int n ) { //... }

int型public成员变量MAX_LENGTH,该值保持为常数100,则定义这个变量的语句是 ( )。A.public int MAX_LENGTH=100B.fmal int MAX_LENGTH=100C.pubic const int MAX_LENGTH=100D.public final int MAX_LENGTH=100

int型public成员变量MAX_LENGTH,该值保持为常数100,则定义这个变量的语句是( )。A.public int MAX LENGTH=100B.final int MAX—LENGTH=100C.public const int MAX_LENGTH=100D.public final int MAX_LENGTH=100

Given:Which code, inserted at line 15, allows the class Sprite to compile?() A.Foo { public int bar() { return 1; }B.new Foo { public int bar() { return 1; }C.new Foo() { public int bar() { return 1; }D.new class Foo { public int bar() { return 1; }

有类定义如下:class Type{public:Type(int i=0);Type operator-(int);friend Type operator+(Type,Type);private:int val;};若有对象定义Type c1;则下列语句序列中,错误的是A.Type(3)+c1;B.c1+Type(3);C.3-c1;D.c1-3;

int型public成员变量MAX_LENGTH,该值保持为常数100,则定义这个变量的语句是( )。A.public int MAX_LENGTH=100B.final int MAX_LENGTH=100C.public const int MAX_LENGTH=100D.public final int MAX_LENGTH=100

int型public成员变量MAX_LENGTH的值保持为常数200,则定义这个变量的语句是______。

int型public成员变量MAX LENGTH,该值保持为常数100,则定义这个变量的语句是( )。A.public int MAX_LENGTH=100B.final int MAX_LENGTH=100C.public const int MAX_LENGTH=100D.public final int MAX_LENGTH=100

A public member vairable called MAX_LENGTH which is int type, the value of the variable remains constant value 100. Use a short statement to define the variable.()   A、 public int MAX_LENGTH=100;B、 final int MAX_LENGTH=100;C、 final public int MAX_LENGTH=100;D、 public final int MAX_LENGTH=100;

public class MethodOver {   public void setVar (int a, int b, float c) {   }   }   Which two overload the setVar method?()A、 Private void setVar (int a, float c, int b) {}B、 Protected void setVar (int a, int b, float c) {}C、 Public int setVar (int a, float c, int b) (return a;)D、 Public int setVar (int a, int b, float c) (return a;)E、 Protected float setVar (int a, int b, float c) (return c;)

MAX_LENGTH是int型public成员变量,变量值保持为常量100,其定义是()。A、final public int MAX_LENGTH=100;B、public int MAX_LENGTH=100;C、public final int MAX_LENGTH=100;D、final int MAX_LENGTH=100;

int型public成员变量MAX_LENGTH,该值保持为常数100,则定义这个变量的语句是()A、public int MAX_LENGTH=100B、final int MAX_LENGTH=100C、public const int MAX_LENGTH=100D、public final int MAX_LENGTH=100

Which method must be defined by a class implementing the java.lang.Runnable interface? () A、 void run()B、 public void run()C、 public void start()D、 void run(int priority)E、 public void run(int priority)F、 public void start(int priority)

public class ConstOver {  public ConstOver (int x, int y, int z)  {  }  }   Which two overload the ConstOver constructor?()   A、 ConstOver ( ) { }B、 Protected int ConstOver ( ) { }C、 Private ConstOver (int z, int y, byte x) { }D、 Public Object ConstOver (int x, int y, int z) { }E、 Public void ConstOver (byte x, byte y, byte z) { }

Which three form part of correct array declarations?()  A、 public int a []B、 static int [] aC、 public [] int aD、 private int a [3]E、 private int [3] a []F、 public final int [] a

public class Parent {  public int addValue( int a, int b) {     int s;     s = a+b;     return s;     }     }  class Child extends Parent {  }  Which methods can be added into class Child?()   A、 int addValue( int a, int b ){// do something...}B、 public void addValue (){// do something...}C、 public int addValue( int a ){// do something...}D、 public int addValue( int a, int b )throws MyException {//do something...}

public class Parent {     int change() {…}     }  class Child extends Parent {     }  Which methods can be added into class Child?()    A、 public int change(){}B、 int chang(int i){}C、 private int change(){}D、 abstract int chang(){}

public abstract class Shape {  private int x;  private int y;  public abstract void draw();  public void setAnchor(int x, int y) {  this.x = x;  this.y = y;  }  }  Which two classes use the Shape class correctly?()A、 public class Circle implements Shape { private int radius; }B、 public abstract class Circle extends Shape { private int radius; }C、 public class Circle extends Shape { private int radius; public void draw(); }D、 public abstract class Circle implements Shape { private int radius; public void draw(); }E、 public class Circle extends Shape { private int radius;public void draw() {/* code here */} }F、 public abstract class Circle implements Shape { private int radius;public void draw() { / code here */ } }

单选题int型public成员变量MAX_LENGTH,该值保持为常数100,则定义这个变量的语句是()Apublic int MAX_LENGTH=100Bfinal int MAX_LENGTH=100Cpublic const int MAX_LENGTH=100Dpublic final int MAX_LENGTH=100

多选题Which statements concerning the following code are true?()   class a {   public a() {}   public a(int i) { this(); }   }   class b extends a {   public boolean b(String msg) { return false; }   }   class c extends b  {  private c() { super(); }   public c(String msg) { this(); }   public c(int i) {}   }AThe code will fail to compile.BThe constructor in a that takes an int as an argument will never be called as a result of constructing an  object of class b or c.CClass c has three constructors.DObjects of class b cannot be constructed.EAt most one of the constructors of each class is called as a result of constructing an object of class c.

单选题Which method must be defined by a class implementing the java.lang.Runnable interface? ()A void run()B public void run()C public void start()D void run(int priority)E public void run(int priority)F public void start(int priority)

单选题MAX_LENGTH是int型public成员变量,变量值保持为常量100,其定义是()。Afinal public int MAX_LENGTH=100;Bpublic int MAX_LENGTH=100;Cpublic final int MAX_LENGTH=100;Dfinal int MAX_LENGTH=100;

单选题A public member vairable called MAX_LENGTH which is int type, the value of the variable remains constant value 100. Use a short statement to define the variable.()A public int MAX_LENGTH=100;B final int MAX_LENGTH=100;C final public int MAX_LENGTH=100;D public final int MAX_LENGTH=100;

单选题public class SyncTest {  private int x;  private int y;  private synchronized void setX( int i ) { x = i; }  private synchronized void setY( int i ) { y = i; }  public void setXY( int i ) { setX(i); setY(i); }  public synchronized boolean check() { return x != y; }  }   Under which condition will check return true when called from a different class? ()A check can never return true.B check can return true when setXY is called by multiple threads.C check can return true when multiple threads call setX and setY separately.D check can return true only if SyncTest is changed to allow x and y to be set separately.

单选题public class Score implements Comparable {  private int wins, losses;  public Score(int w, int 1) { wins = w; losses = 1; }  public int getWins() { return wins; }  public int getLosses() { return losses; }  public String toString() {  return “”; }  // insert code here  }  Which method will complete this class?()A public int compareTo(Object o) {/*mode code here*/}B public int compareTo(Score other) {/*more code here*/}C public int compare(Score s1,Score s2){/*more code here*/}D public int compare(Object o1,Object o2){/*more code here*/}

多选题MAX_LENGTH是int型public成员变量, 变量值保持为常量100,用简短语句定义这个变量。()Apublic int MAX_LENGTH=100;Bfinal int MAX_LENGTH=100;Cfinal public int MAX_LENGTH=100;Dpublic final int MAX_LENGTH=100.

单选题public class SyncTest {  private int x;   private int y;   public synchronized void setX (int i) (x=1;)   public synchronized void setY (int i) (y=1;)   public synchronized void setXY(int 1)(set X(i); setY(i);)   public synchronized Boolean check() (return x !=y;)   }   Under which conditions will check () return true when called from a different class?A Check() can never return true.B Check() can return true when setXY is called by multiple threads.C Check() can return true when multiple threads call setX and setY separately.D Check() can only return true if SyncTest is changed to allow x and y to be set separately.