1. Known expression int m[] = {0,1,2,3,4,5,6}; The value of the following expression and the array The lengths are equal ()
A m.length()
B. m.length
C. m.length() 1
D. m.length 1
Answer: B
Analysis: The length of the array is .length
2. Below Are those claims legitimate? ()
A long l = 4990
B. int i = 4L
C. float f = 1.1
D. double d = 34.4
Answer: AD
Analysis: B int belongs to integer type and should be int=4 C should be float f=1.1f
3. Select the correct java expression () from the following options
A int k=new String("aa")
B. String str = String("bb" )
C. char c=74;
D. long j=8888;
Answer: CD
Analysis: A requires forced type conversion B String str =new String("bb")
4. The output result of the following code is
System.out.println(""+("12"=="12"&&"12".equals("12"))); (“12”==”12”&&”12”.equals(“12”)) “12”==”12”&&”12”.equals(“12”)
true
false
5. Which of the following operators contain short-circuit operation mechanism? Please select: ()
A &
B. &&
#C. |
D. ||
Answer: BD
Analysis: A C is logic and calculation
6. Which of the following functions is the key to public void example(){....} load function? ()
A private void example(int m){...}
B. public int example(){...}
C. public void example2(){...}
D. public int example(int m.float f){...}
Answer: AD
Analysis: BC defines a new function
7. Given a certain java program fragment, after the program is run, the output result of j is ()
int i=1; Int j=i++; If((j>++j)&&(i++==j)){j+=i:} System.out.println(j);
A 1
B. 2
C. 3
D. 4
Answer: B
Analysis: i is quoted first. i is added first and then quoted
8. In java, no matter what the test condition is, the following () loop will be executed at least once.
A for
B. do...while
C. while
D. while...do
Answer: B
Analysis: ACD does not necessarily cycle
9. Print result:
package cn.wuliaokankan; public class smaillT{ public static void main(String args[]){ smaillT t=new smaillT(); int b = t.get(); System.out.println(b); } public int get() { try { return 1; }finally{ return 2; } }
Output result:
2
10. Indicate the running result of the following program
int i=9; switch (i) { default: System.out.println("default"); case 0: System.out.println("zero"); break; case 1: System.out.println("one"); break; case 2: System.out.println("two"); break; }
Print result:
zero
The above is the detailed content of Common multiple choice questions in Java written test. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 Mac version
God-level code editing software (SublimeText3)