A programmer needs to create a logging method that can accept an arbitrary number of arguments. For example, it may be called in these ways: logIt(”log message 1 “); logIt(”log message2”,”log message3”); logIt(”log message4”, “log message5”, “log message6); Which declaration satisfies this requirement?()
A: public void logIt(String * msgs)
B: public void logIt(String [] msgs)
C: public void logIt(String... msgs)
D: public void logIt(String msg1, String msg2, String msg3)
A: public void logIt(String * msgs)
B: public void logIt(String [] msgs)
C: public void logIt(String... msgs)
D: public void logIt(String msg1, String msg2, String msg3)
举一反三
- 给出以下Action的Struts.XML配置文件描述(注1:请求为Test/Hello_onPlay.action)package com.yourcompany.action;public class HelloWorldAction{private String message;public String getMessage(){return message;}public void setMessage(String message){this.message = message;}public String onPlay() throws Exception{System.out.println(this.getMessage());return "success";}public String execute() throws Exception{System.out.println(this.getMessage());return "success";}}
- 【单选题】下列哪个是 Java 应用程序主类中正确的 main 方法声明? A) public void main (String args[ ]) B) static void main (String args[ ]) C) public static void Main (String args[]) D) public static void main (String args[ ]) A. public void main (String args[ ]) B. static void main (String args[ ]) C. public static void Main (String args[]) D. public static void main (String args[ ])
- 以下关于方法声明中正确的是() A: A.public final writeLog(String msg) B: B.public final abstract void writeLog(String msg) C: C.public static final void writeLog(String msg) D: D.public static abstract void writeLog(String msg)
- 下列Java应用程序定义正确的是( ) A: public void main(String args[]) {……} B: static void main(String args){……} C: public static void Main(String args[]){…} D: public static void main(String args[]){……}
- 下面()是正确的main()方法。 A: public void main(String[] args) B: public static main(String[] args) C: public static void main() D: public static void main(String[] args)