java基础题月考JSD1908(含答案和解析)

2022-10-15,,,

考试

* {
tap-highlight-color: transparent;
-webkit-tap-highlight-color: transparent;
-ms-tap-highlight-color: transparent;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}

a, abbr, acronym,
address, applet, article, aside, audio, b, big,
blockquote, body, canvas, caption, center, cite,
code, dd, del, details, dfn, div, dl, dt, em,
embed, fieldset, figcaption, figure, footer, form,
h1, h2, h3, h4, h5, h6, header, hgroup, html, i,
iframe, img, ins, kbd, label, legend, li, mark,
menu, nav, object, ol, output, p, pre, q, ruby, s,
samp, section, small, span, strike, strong, sub,
summary, sup, table, tbody, td, tfoot, th,
thead, time, tr, tt, u, ul, var, video {
margin: 0;
padding: 0;
border: 0;
outline: 0
}

article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
display: block
}

html {
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
font-size: 62.5%;
}

body {
font-family: microsoft yahei, helvetica neue, helvetica, stheiti, arial, sans-serif;
font-size: 14px;
line-height: 1.4;
}

ol,
ul {
list-style: none
}

a,
div,
header,
span {
-webkit-tap-highlight-color: rgba(255, 255, 255, 0)
}

a,
body {
color: #1a1a1a
}

a {
text-decoration: none
}

table {
border-collapse: collapse;
border-spacing: 0
}

input,
textarea {
outline: 0;
resize: none
}

h1,
h2,
h3,
h4,
h5,
h6,
strong {
font-size: 100%;
font-weight: 400
}

img {
vertical-align: middle;
border: 0;
-ms-interpolation-mode: bicubic
}

audio,
video {
display: inline-block;
}

button,
input,
optgroup,
select,
textarea {
margin: 0;
}

button,
input {
overflow: visible;
}

button,
select {
text-transform: none;
}

button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0;
}

button,
html [type="button"],
[type="reset"],
[type="submit"] {
-webkit-appearance: button;
}

textarea {
overflow: auto;
}

[type="checkbox"],
[type="radio"] {
box-sizing: border-box;
padding: 0;
}

.clearfix:after {
clear: both;
content: ".";
display: block;
font-size: 0;
height: 0;
line-height: 0;
visibility: hidden;
}

.clearfix {
*zoom: 1
}

.container {
clear: both;
margin: 0 auto;
text-align: left;
/*width: 1200px;*/
}

.container:after {
clear: both;
content: ".";
display: block;
font-size: 0;
height: 0;
line-height: 0;
visibility: hidden;
}

.pull-left {
float: left;
}

.pull-right {
float: right;
}

.text-left {
text-align: left;
}

.text-right {
text-align: right;
}

.text-center {
text-align: center;
}

.vspace {
height: 10px;
font-size: 0px;
line-height: 0px;
width: 99%;
clear: both;
}

.vspace-padding {
height: 0px;
font-size: 0px;
line-height: 0px;
width: 99%;
clear: both;
padding-top: 10%;
}

.vspace-padding:after {
clear: both;
content: ".";
display: block;
font-size: 0;
height: 0;
line-height: 0;
visibility: hidden;
}

.vspace-em {
font-size: inherit;
height: 1em;
line-height: 1;
width: 99%;
clear: both;
}

.width-100 {
width: 100%;
}

.font-16 {
font-size: 16px;
}

.color-red {
color: #e74c3c;
}

/* 登录页 */
.login-page {
min-width: 1000px;
}

.md2018112301lty {
width: 1000px;
margin: 0 auto;
height: 132px;
line-height: 132px;
}

.md2018112302lty {
height: 495px;
background-color: #5cbaff;
}

.md2018112302lty .container {
height: 100%;
width: 1000px;
position: relative;
}

.md-2018040401-ll {
background: #fff;
width: 344px;
position: absolute;
right: 54px;
top: 35px;
padding: 24px 0 0 0;
box-shadow: 0 5px 20px 2px #0093ff;
}

.md-2018040401-ll .tab-header > ul {
padding: 16px 0;
border-bottom: 1px solid #eee;
}

.md-2018040401-ll .tab-header > ul > li {
color: #666;
cursor: pointer;
font-size: 20px;
text-align: center;
border-right: 1px solid #eee;
}

.md-2018040401-ll .tab-header > ul > li.active {
color: #0093ff;
font-weight: bold;
}

.md-2018040401-ll .tab-cont {
padding: 30px 31px 0 31px;
}

.md-2018040401-ll .tab-cont .form-ele-box .form-item {
margin-bottom: 30px;
}

.md-2018040401-ll .tab-cont .form-ele-box .form-input {
background: #f7f7f7;
border-color: #f7f7f7;
padding-left: 37px;
}

.md-2018040401-ll .tab-cont .form-inp-area .cusfont {
position: absolute;
left: 11px;
top: 10px;
color: #babfc5;
font-size: 20px;
}

.md-2018040401-ll .tab-cont .form-ele-box .err-msg {
font-size: 12px;
color: #f4334a;
font-weight: bold;
line-height: 1.4;
}

.md-2018040401-ll .tab-cont .form-ele-box .err-msg span.hide {
opacity: 0;
}

.md-2018040401-ll .tab-cont .form-ele-box .form-btn {
font-weight: bold;
font-size: 16px;
}

.md-2018040401-ll .form-ele-box .form-item .register-link {
color: #f4334a;
font-size: 12px;
}

.md-2018040401-ll .tab-cont .tab-item {
display: none;
}

.md-2018040401-ll .tab-cont .tab-item.active {
display: block;
}

.md-2018040401-ll .tab-cont .ewm-box {
padding: 21px 53px 20px 53px;
}

.md-2018040401-ll .tab-cont .ewm-box .ewm {
width: 176px;
height: 167px;
padding: 8px 12px;
border: 1px solid #f4f4f4;
}

.md-2018040401-ll .tab-cont .tips {
color: #333;
font-size: 14px;
margin-bottom: 80px;
}

.md-2018040401-ll .tab-cont .tips > a {
color: #0093ff;
}

/* 表单元素 start */

.form-ele-box {
font-size: 14px;
}

.form-ele-box .form-item {
margin-bottom: 18px;
}

.form-ele-box .form-label {
display: inline-block;
line-height: 1.4;
margin-bottom: 5px;
max-width: 100%;
}

.form-ele-box .form-checkbox {
position: relative;
display: block;
}

.form-ele-box.form-inline-box .form-checkbox {
display: inline-block;
}

.form-ele-box.form-inline-box .form-label {
float: left;
text-align: right;
width: 100px;
margin-right: 15px;
margin-bottom: 0;
height: 40px;
line-height: 38px;
}

.form-ele-box .form-inp-area {
position: relative;
}

.form-ele-box .form-inp-area .form-tips {
font-size: 12px;
position: absolute;
right: 2px;
top: -17px;
color: #f44336;
display: none;
}

.form-ele-box .form-inp-area.error .form-tips {
display: inline-block;
}

.form-ele-box .form-inp-area.error .form-input {
border-color: #f44336;
}

.form-ele-box .form-input {
display: block;
height: 40px;
line-height: 38px;
background: #fff;
border: 1px solid #ccc;
padding: 0 10px;
outline: none;
color: #262e39;
border-radius: 3px;
width: 100%;
}

.form-ele-box .form-input.form-textarea {
height: 134px;
line-height: 24px;
padding: 10px;
}

.form-ele-box.form-inline-box .form-inp-area {
width: 340px;
float: left;
}

.form-ele-box .form-input[readonly] {
background-color: #eee;
opacity: 1;
}

.form-ele-box .form-input:focus {
border: 1px solid #4f8dfe;
}

.form-ele-box .form-input.error {
border: 1px solid #ed2122;
}

.form-ele-box .form-inlineblock {
display: inline-block;
height: 40px;
width: 100px;
}

.form-ele-box .code-box .code-btn {
font-size: 12px;
cursor: pointer;
}

/* checkbox and radio start */

.form-checkbox > label {
padding-left: 20px;
position: relative;
}

.form-checkbox label > span {
display: inline-block;
vertical-align: middle;
position: relative;
padding-left: 5px;
}

.form-checkbox label > input[type="checkbox"],
.form-checkbox label > input[type="radio"] {
position: absolute;
left: 0;
top: 0;
opacity: 0;
z-index: 1;
}
.form-checkbox label p {
display: inline-block;
position: relative;
}
.form-checkbox label > input[type="checkbox"] + p::before {
content: "";
display: inline-block;
position: absolute;
width: 14px;
height: 14px;
left: 0;
top: 1px;
margin-left: -20px;
border: 1px solid #cccccc;
border-radius: 3px;
background-color: #fff;
}

.form-checkbox label > input[type="radio"] + p::before {
content: "";
display: inline-block;
position: absolute;
width: 14px;
height: 14px;
left: 0;
top: 1px;
margin-left: -20px;
border: 1px solid #cccccc;
border-radius: 50%;
background-color: #fff;
}

.form-checkbox label > input[type="checkbox"] + p::after {
display: inline-block;
position: absolute;
width: 13px;
height: 13px;
left: 0;
top: 0;
margin-left: -20px;
padding-left: 3px;
padding-top: 1px;
font-size: 11px;
color: #555555;
}

.form-checkbox label > input[type="radio"] + p::after {
display: inline-block;
position: absolute;
content: " ";
width: 8px;
height: 8px;
left: 4px;
top: 5px;
margin-left: -20px;
border-radius: 50%;
background-color: #555555;
-webkit-transform: scale(0, 0);
-ms-transform: scale(0, 0);
-o-transform: scale(0, 0);
transform: scale(0, 0);
}

.form-checkbox label > input[type="checkbox"]:focus + p::before,
.form-checkbox label > input[type="radio"]:focus + p::before {
outline: thin dotted;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}

.form-checkbox label > input[type="checkbox"]:checked + p::after {
font-family: "cusfont";
content: "\e6df";
}

.form-checkbox label > input[type="radio"]:checked + p::after {
-webkit-transform: scale(1, 1);
-ms-transform: scale(1, 1);
-o-transform: scale(1, 1);
transform: scale(1, 1);
}

.form-checkbox label > input[type="checkbox"]:disabled + p,
.form-checkbox label > input[type="radio"]:disabled + p {
opacity: 0.65;
}

.form-checkbox label > input[type="checkbox"]:disabled + p::before,
.form-checkbox label > input[type="radio"]:disabled + p::before {
background-color: #eeeeee;
cursor: not-allowed;
}

.form-checkbox.checkbox-circle label > p::before {
border-radius: 50%;
}

.form-checkbox.checkbox-inline {
margin-top: 0;
}

.form-checkbox-primary label > input[type="checkbox"]:checked + p::before {
background-color: #337ab7;
border-color: #337ab7;
}

.form-checkbox-primary label > input[type="radio"]:checked + p::before {
border-color: #337ab7;
}

.form-checkbox-primary label > input[type="checkbox"]:checked + p::after {
color: #fff;
}

.form-checkbox-primary label > input[type="radio"]:checked + p::after {
background-color: #337ab7;
}

.form-checkbox-danger label > input[type="checkbox"]:checked + p::before {
background-color: #d9534f;
border-color: #d9534f;
}

.form-checkbox-danger label > input[type="radio"]:checked + p::before {
border-color: #d9534f;
}

.form-checkbox-danger label > input[type="checkbox"]:checked + p::after {
color: #fff;
}

.form-checkbox-danger label > input[type="radio"]:checked + p::after {
background-color: #d9534f;
}

.form-checkbox-info label > input[type="checkbox"]:checked + p::before {
background-color: #5bc0de;
border-color: #5bc0de;
}

.form-checkbox-info label > input[type="radio"]:checked + p::before {
border-color: #5bc0de;
}

.form-checkbox-info label > input[type="checkbox"]:checked + p::after {
color: #fff;
}

.form-checkbox-info label > input[type="radio"]:checked + p::after {
background-color: #5bc0de;
}

.form-checkbox-warning label > input[type="checkbox"]:checked + p::before {
background-color: #f0ad4e;
border-color: #f0ad4e;
}

.form-checkbox-warning label > input[type="radio"]:checked + p::before {
border-color: #f0ad4e;
}

.form-checkbox-warning label > input[type="checkbox"]:checked + p::after {
color: #fff;
}

.form-checkbox-warning label > input[type="radio"]:checked + p::after {
background-color: #f0ad4e;
}

.form-checkbox-success label > input[type="checkbox"]:checked + p::before {
background-color: #5cb85c;
border-color: #5cb85c;
}

.form-checkbox-success label > input[type="radio"]:checked + p::before {
border-color: #5cb85c;
}

.form-checkbox-success label > input[type="checkbox"]:checked + p::after {
color: #fff;
}

.form-checkbox-success label > input[type="radio"]:checked + p::after {
background-color: #5cb85c;
}

/* checkbox and radio end */

/* 表单元素 end */

/* 按钮 start */

.form-btn {
display: inline-block;
padding: 5px 24px 6px;
margin-bottom: 0;
font-size: 14px;
font-weight: normal;
line-height: 1.42857143;
text-align: center;
white-space: nowrap;
vertical-align: middle;
-ms-touch-action: manipulation;
touch-action: manipulation;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-image: none;
border: 1px solid transparent;
border-radius: 4px;
height: 32px;
}

.form-btn:focus,
.form-btn:active:focus,
.form-btn.active:focus,
.form-btn.focus,
.form-btn:active.focus,
.form-btn.active.focus {
outline: thin dotted;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}

.form-btn:hover,
.form-btn:focus,
.form-btn.focus {
color: #333;
text-decoration: none;
}

.form-btn:active,
.form-btn.active {
background-image: none;
outline: 0;
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
}

.form-btn.disabled,
.form-btn[disabled] {
cursor: not-allowed;
filter: alpha(opacity=65);
-webkit-box-shadow: none;
box-shadow: none;
opacity: .65;
}

.form-btn-red {
color: #fff;
background-color: #fc583d;
border-color: #fc583d;
}

.form-btn-red:focus,
.form-btn-red.focus {
color: #fff;
background-color: #f74528;
border-color: #f74528;
}

.form-btn-red:hover {
color: #fff;
background-color: #f74528;
border-color: #f74528;
}

.form-btn-red:active,
.form-btn-red.active {
color: #fff;
background-color: #f74528;
border-color: #f74528;
}

.form-btn-blue {
color: #fff;
background-color: #4b95ff;
border-color: #4b95ff;
}

.form-btn-blue:focus,
.form-btn-blue.focus {
color: #fff;
background-color: #2a75fe;
border-color: #2a75fe;
}

.form-btn-blue:hover {
color: #fff;
background-color: #2a75fe;
border-color: #2a75fe;
}

.form-btn-blue:active,
.form-btn-blue.active {
color: #fff;
background-color: #2a75fe;
border-color: #2a75fe;
}

.form-btn-default {
color: #4b95ff;
background-color: #fff;
border-color: #4b95ff;
}

.form-btn-default:focus,
.form-btn-default.focus {
color: #2a75fe;
border-color: #2a75fe;
}

.form-btn-default:hover {
color: #2a75fe;
border-color: #2a75fe;
}

.form-btn-default:active,
.form-btn-default.active {
color: #2a75fe;
border-color: #2a75fe;
}

/* 按钮 end */
/* 下拉选 */
.x-choose-down .x-ipt-group {
width: 340px;
height: 40px;
border: 1px solid #ccc;
border-radius: 3px;
padding-left: 8px;
color: #999;
background: #fff;
display: inline-block;
position: relative;
}

.x-ipt-group .custom_sel_text {
cursor: pointer;
height: 38px;
line-height: 38px;
}

.x-ipt-group span {
display: inline-block;
height: 100%;
width: 28px;
border-left: 1px solid #dedede;
background-color: #f6f5fb;
position: absolute;
top: 0;
right: 0;
cursor: pointer;
}

.x-ipt-group .custom_sel_list {
top: 100%;
background: #fff;
width: 100%;
left: 0px;
position: absolute;
border: 1px solid #dedede;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
z-index: 1;
}

.x-ipt-group .custom_sel_list li {
cursor: pointer;
padding: 0 10px;
color: #8e8f90;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin: 0;
line-height: 35px;
}

.x-ipt-group .custom_sel_list li:hover {
background: #f8f8f8;
}

.md2018112303lty {
width: 1000px;
margin: 0 auto;
height: 133px;
font-size: 12px;
line-height: 2.08;
color: #999;
}

.md2018112303lty .list-links li {
float: left;
margin-right: 16px;
}

.md2018112303lty .list-links li > a {
color: #999;
}

.md2018112303lty .links-box {
display: inline-block;
margin-top: 30px;
}

/*xxw 20180412 新增 colorbox相关*/

#colorbox {
z-index: 1000;
}

#colorbox:focus {
outline: none;
}

#cboxcontent #cboxclose {
display: none !important;
}

#cboxoverlay {
position: fixed;
width: 100%;
height: 100%;
top: 0;
background: rgba(0, 0, 0, 0.6);
z-index: 999;
}

.cus-win-model .cus-win-modelclose {
position: absolute;
top: 10px;
right: 15px;
cursor: pointer;
font-size: 20px;
}

.md-2018121001-xxw {
background: #060709;
height: 70px;
line-height: 68px;
}

.md-2018121001-xxw .nav-xxw {
color: #a0a0a0;
margin-left: 68px;
}

.md-2018121001-xxw .nav-xxw .active {
color: #fff;
}

.md-2018121001-xxw .nav-xxw li {
float: left;
margin-right: 35px;
}

.md-2018121001-xxw .nav-xxw li a {
display: block;
color: inherit;
}

.color-a0a0a0 {
color: #a0a0a0;
}

.md-2018121001-xxw .time-box {
color: #d92424;
font-weight: bold;
margin-right: 20px;
margin-left: 5px;
}
.padding-100 {
padding: 70px 0px 20px;
}
.md-2018121002-xxw .hd {
margin-bottom: 20px;
color: #333;
font-weight: bold;
}
.md-2018121002-xxw .hd .no-true {
background: #d92525;
color: #fff;
width: 108px;
font-weight: normal;
display: none;
border-radius: 10px;
padding: 1px 5px;
margin-top: 5px;
margin-left: 20px;
}
.md-2018121002-xxw .item-listx label {
display: block;
padding: 10px 40px;
border: 1px solid transparent;
}
.md-2018121002-xxw .item-listx label:hover {
background: #f8f8f8;
}
.md-2018121002-xxw .item-listx label:active {
border: 1px solid #29b2f7;
}
.md-2018121002-xxw .test-paper-list {
margin-bottom: 56px;
}
.md-2018121002-xxw textarea{
min-height: 44px;
padding: 5px 20px;
width: 100%;
border: 1px solid #e5e5e5;
}
.md-2018121002-xxw .test-paper-list textarea:focus {
border: 1px solid #29b2f7;
}
textarea {
background: #f8f8f8;
resize: none;
}
.paper-body-xxw {
background: #fff;
margin-top: 40px;
margin-bottom: 60px;
padding-bottom: 40px;
position: relative;
padding-top: 50px;
}
.bg-f3f2f2 {
background: #f3f2f2;
}
.md-2018121004-xxw {
width: 230px;
overflow: hidden;
box-shadow: 0 0 20px #eee;
border-radius: 10px;
transition: 0.5s;
}
.md-2018121004-xxw .md-body {
width: 230px;
color: #fff;
background: #fff;
padding-bottom: 20px;
}
.md-2018121004-xxw .md-hd {
line-height: 40px;
position: relative;
background: #1bbc9b;
}
.md-2018121004-xxw .md-bd {
padding: 20px 0 10px 20px;
max-height: 280px;
overflow: auto;
}
.dtk-iconx {
position: absolute;
top: 7px;
left: 10px;
font-size: 24px;
cursor: pointer;
}
.md-2018121004-xxw .form-btn {
border-radius: 20px;
padding: 0 30px;
line-height: 30px;
background: #1bbc9b;
}

.md-2018121004-xxw .tihao {
float: left;
width: 24px;
height: 24px;
text-align: center;
line-height: 23px;
margin-right: 15px;
color: #acacac;
margin-bottom: 15px;
border: 1px solid #acacac;
border-radius: 24px;
}
.md-2018121004-xxw .tihao.active {
background: #1bbc9b;
color: #fff;
border-color: transparent;
}

.md-2018121002-xxw .kong_xxw {
min-width: 80px;
width: 80px;
padding: 0 10px;
border: none;
outline: none;
border-bottom: 1px solid #aaa;
color: #1bbc9b;
}
.md-2018121004-xxw {
position: fixed;
top: 20%;
right:15%
}
.md-2018121004-xxw.mini-box {
width: 45px;
height: 40px;
transition: 0.5s;
}
.md-2018121101-xxw {
width: 290px;
}
.md-2018121101-xxw .md-hd {
width: 258px;
margin: 0 auto;
border-radius: 12px 12px 0 0;
height: 30px;
background: url("../images/img_2018121101_xxw.png") no-repeat center;
}
.md-2018121101-xxw .md-bd {
background: #fff;
border-radius: 12px;
}
.md-2018121101-xxw .md-bd .p1{
padding: 30px;
line-height: 24px;
}
.md-2018121101-xxw .form-btn {
border-radius: 20px;
padding: 0 46px;
line-height: 36px;
height: 38px;
margin-bottom: 25px;
}
.md-2018121101-xxw .form-btn.btn2 {
background: #dbeaff;
margin-left: 15px;
}
.color-28b2f7 {
color: #28b2f7;
}
.bg-fff {
background: #fff;
}
.padding-40px {
padding: 0 40px;
}
.md-2018121102-xxw .md-hd{
line-height: 50px;
margin: 28px 0;
border-radius: 8px;
font-size: 16px;
font-weight: bold;
}
.md-2018121102-xxw > .md-bd{
padding: 30px 40px;
}
.md-2018121102-xxw .form-group {
width: 800px;
height: 48px;
border-radius: 4px;
border: 1px solid #bdc3c7;
overflow: hidden;
}
.md-2018121102-xxw .form-group input{
width: 750px;
height: 100%;
padding-left: 10px;
background: #fdfdfd;
border:none
}
.md-2018121102-xxw .form-group span {
width: 48px;
height: 50px;
font-size: 24px;
background: #bdc3c7;
text-align: center;
line-height: 46px;
color: #fff;
cursor: pointer;
}
.md-2018121102-xxw .form-group span:hover {
background: #aaa;
}
.md-2018121102-xxw .curs-x{
padding-top: 27px;
}
.md-2018121102-xxw .curs-x .active {
color: #28b2f7;
}

.pagination {
display: inline-block;
padding-left: 0;
margin: 20px 0;
border-radius: 4px;
}
.pagination > li {
display: inline-block;
margin: 0 5px;
}
.pagination > li > a,
.pagination > li > span {
position: relative;
float: left;
padding: 6px 12px;
margin-left: -1px;
line-height: 1.42857143;
color: #337ab7;
text-decoration: none;
background-color: #fff;
border: 1px solid #ddd;
}
.pagination > li:first-child > a,
.pagination > li:first-child > span {
margin-left: 0;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
.pagination > li:last-child > a,
.pagination > li:last-child > span {
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
.pagination > li > a:hover,
.pagination > li > span:hover,
.pagination > li > a:focus,
.pagination > li > span:focus {
z-index: 2;
color: #23527c;
background-color: #eee;
border-color: #ddd;
}
.pagination > .active > a,
.pagination > .active > span,
.pagination > .active > a:hover,
.pagination > .active > span:hover,
.pagination > .active > a:focus,
.pagination > .active > span:focus {
z-index: 3;
color: #fff;
cursor: default;
background-color: #337ab7;
border-color: #337ab7;
}
.pagination > .disabled > span,
.pagination > .disabled > span:hover,
.pagination > .disabled > span:focus,
.pagination > .disabled > a,
.pagination > .disabled > a:hover,
.pagination > .disabled > a:focus {
color: #777;
cursor: not-allowed;
background-color: #fff;
border-color: #ddd;
}
.pagination-lg > li > a,
.pagination-lg > li > span {
padding: 10px 16px;
font-size: 18px;
line-height: 1.3333333;
}
.pagination-lg > li:first-child > a,
.pagination-lg > li:first-child > span {
border-top-left-radius: 6px;
border-bottom-left-radius: 6px;
}
.pagination-lg > li:last-child > a,
.pagination-lg > li:last-child > span {
border-top-right-radius: 6px;
border-bottom-right-radius: 6px;
}
.pagination-sm > li > a,
.pagination-sm > li > span {
padding: 5px 10px;
font-size: 12px;
line-height: 1.5;
}
.pagination-sm > li:first-child > a,
.pagination-sm > li:first-child > span {
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
}
.pagination-sm > li:last-child > a,
.pagination-sm > li:last-child > span {
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
}
.table-bordered tr {
border-bottom: 1px solid #ddd;
}
.table-bordered tr td,
.table-bordered tr th{
padding: 15px 5px;
}
.table-bordered tbody {
border-top: 1px solid #ccc;
}
.table-bordered thead tr {
border: none;
}
.datatables_paginate {
text-align: center;
margin-top: 26px;
}
div.datatables_wrapper div.datatables_processing {
position: absolute;
top: 50%;
left: 50%;
width: 200px;
margin-left: -100px;
margin-top: -26px;
text-align: center;
padding: 1em 0;
}
.panel {
margin-bottom: 20px;
background-color: #fff;
border: 1px solid transparent;
border-radius: 4px;
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05);
box-shadow: 0 1px 1px rgba(0,0,0,.05);
}
.table-box {
margin-top: 40px;
}
.table-box .table-numx {
display: inline-block;
width: 25px;
line-height: 25px;
background: #29b2f7;
color: #fff;
border-radius: 15px;
}
.table-box .ks-typex {
display: inline-block;
line-height: 26px;
background: #ec7064;
color: #fff;
padding: 0 16px;
border-radius: 15px;
}
.table-box .ks-typex.ks-typex1 {
background: #c0ccdc;
}
.table-box .ks-btn {
display: inline-block;
line-height: 26px;
background: #29b2f7;
color: #fff;
padding: 2px 8px;
border-radius: 4px;
cursor: pointer;
}

.md-2018121301-xxw .md-hd {
padding: 10px 100px;
}
.md-2018121201-xxw {
padding: 30px 100px;
border-radius: 8px;
background: #fff;
margin-top: 38px;
}
.md-2018121203-xxw .md-tit{
padding: 13px 20px;
color: #666;
}
.md-2018121203-xxw.active .md-tit {
background: #29b2f7;
color: #fff;
}
.font-bold {
font-weight: bold;
}
.md-2018121203-xxw.active .iconx {
background: url("../images/up_iconx.png") no-repeat center;
}
.md-2018121203-xxw .iconx {
cursor: pointer;
display: inline-block;
width: 20px;
height: 20px;
margin-left: 20px;
background: url("../images/down_iconx.png") no-repeat center;
vertical-align: middle;
}
.md-2018121203-xxw .iconx1 {
display: inline-block;
width: 18px;
height: 18px;
line-height: 16px;
background: #ec7064;
padding-left: 3px;
color: #fff;
border-radius: 15px;
font-weight: bold;
margin-left: 10px;
font-size: 16px;
}
.md-2018121203-xxw .md-cont {
padding: 30px 20px 0;
/*border: 1px solid #ebeced;*/
}
.md-2018121203-xxw .md-2018121002-xxw .item-listx label:hover {
background: none;
}
.md-2018121203-xxw .md-2018121002-xxw .item-listx label:active {
border-color: transparent;
}
.md-2018121002-xxw .md-footer {
background: #f8f8f8;
padding: 10px 15px;
margin-top: 20px;
line-height: 18px;
}
.md-2018121002-xxw .md-footer .d1 {
margin-bottom: 3px;
}
.md-2018121203-xxw .md-2018121002-xxw {
margin-bottom: 36px;
}
.md-2018121203-xxw {
margin-bottom: 30px;
overflow: hidden;
border-radius: 8px;
border: 1px solid #ebeced;
}
.md-2018121203-xxw>.md-cont {
display: none;
}
.md-2018121002-xxw .padding-100 {
padding-bottom: 0;
padding-top: 0;
}
/*.md-2018121002-xxw {
padding-top: 40px;
}*/
.other-1221-hd {
padding: 0 22px;
line-height: 42px;
background: #d4f0fd;
color: #014c85;
font-size: 22px;
width: 1150px;
margin: 0 auto;
margin-bottom: 36px;

}
.other-1221-hd .s1 {
font-size: 16px;
}
.xxw107-icon {
display: inline-block;
padding:8px;
position: relative;
top: 2px;
display: none;
}
.no-paper-xxw .xxw107-icon {
background: url("../images/iconxx0107_03.png") no-repeat;
display: inline-block;
}
.yes-paper-xxw .xxw107-icon {
background: url("../images/iconxx0107_06.png") no-repeat;
display: inline-block;
}
.datatables_filter {
display: none!important;
}

.score-xxw {
width: 200px;
height: 24px;
line-height: 24px;
margin-top: 15px;
padding-left: 5px;
}

.input-other {
position: absolute;
right: 0;
top: 0;
width: 100px;
height: 30px;
line-height: 30px;
}
.md-2019011601-xxw {
width: 444px;
height: 450px;
overflow: hidden;
}
.md-2019011601-xxw .md-hd {
border-radius: 15px 15px 0 0;
overflow: hidden;
}
.md-2019011601-xxw .p1 {
line-height: 28px;
padding:30px 36px 50px;
background: #fff;
border-radius: 0 0 15px 15px;
color: #666;
}
.md-2019011601-xxw .btn2 {
width: 200px;
height: 54px;
line-height: 44px;
color: #fff;
font-size: 16px;
text-align: center;
margin-top: -27px;
box-shadow: 0 0 10px #2a75fe;
border-radius: 52px;
}

.md-2019021301-xxw {
font-size: 16px;
}
.md-2019021301-xxw .iconsx-2 {
display: none;
}
.js-single-box .md-2019021301-xxw .iconsx-2,
.js-multiple-box .md-2019021301-xxw .iconsx-2 {
display: inline-block;
vertical-align: middle;
}
.md-2019021301-xxw .iconsx-2 i.active {
display: inline-block;
width: 17px;
height: 17px;
/* background-image: url(../images/icon2019021301.png);*/
cursor: pointer;
}
.md-2019021301-xxw .iconsx-2 i:first-child.active {
background-position: 0px 0px;
}
.md-2019021301-xxw .iconsx-2 i:last-child.active {
background-position: 17px 0px;
}
.other-ipt0213 {
width: 52px;
height: 18px;
border: 1px solid #ccc;
background: #fff;
vertical-align: middle;
display: inline-block;
position: relative;
top: -1px;
}
.top-ipt0213 {
padding: 1px 30px 10px;
position: absolute;
top: 0;
right: 0px;
}
.top-ipt0213 input {
font-size: 36px;
color: #da4453;
border: none;
border-bottom: 1px solid #ccc;
vertical-align: bottom;
outline: none;
width: 80px;
line-height: 37px;
}
.class-20190222 {
padding-top: 70px;
}
.class-20190222 .page-header {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 999;
}
.md-2018121002-xxw .hd>.tit {
display: flex;
align-items: baseline;
}
xmp {
white-space: pre-wrap;
display: inline;
}
/*题海*/
.md2019030601-xxw .box {
width: 348px;
margin: 0 auto;
}
.md2019030601-xxw .x-choose-down {
margin-bottom: 30px;
}
.md2019030601-xxw .x-choose-down .x-ipt-group {
width: 100%;
height: 38px;
border: 1px solid #d2d2d2;
border-radius: 1px;
color: #999;
padding-left: 0;
}
.md2019030601-xxw .custom_sel_text {
color: #666;
font-size: 16px;
}
.md2019030601-xxw .x-ipt-group .custom_sel_list {
margin: 0 -1px;
}
.md2019030601-xxw .form-btn {
margin-top: 50px;
width: 100%;
background: #29b2f7;
border-radius: 0;
border: none;
}

xmp {
font-family: microsoft yahei, helvetica neue, helvetica, stheiti, arial, sans-serif;
}

 

| 
得分: 满分:2分

1、【单选题】

(单选题)分析如下代码,输出结果正确的是():
class test{
public static void main(string[] args){
int i=5;
system.out.println(i++);
system.out.println(i);
}
}

a.6
6

b.5
5

c.5
6

d.6
7

【正确答案】c
【答案解析】这里考的是算术运算符中的++运算符
java中,++为自增运算符,给变量本身增1。--为自减运算符,给变量本身减1。
i++为一个表达式,此表达式的值就是变量i的值,即为5,所以system.out.println(i++),输出的就是5。
因为在此处已经进行i++了,所以i本身的值会增1而变为6,所以下面system.out.println(i),输出的就是6。
所以本题c选项是正确的,abd都是错误的。


 

| 
得分: 满分:2分

2、【单选题】

(单选题)在java中有一个类aoo,下面为其构造方法的声明,正确的是()。

a.void aoo(){ }

b.aoo(){ }

c.aoo(){ }

d.void aoo(){ }

【正确答案】b
【答案解析】此题目考查的是java中的构造方法。
java中的构造方法,必须与类同名,并且没有返回值类型(连void都没有)。所以本题正确选项为b。


 

| 
得分: 满分:2分

3、【单选题】

(单选题)在java中,下列代码的运行结果是()。
public static void main(string[] args){
int[] arr = new int[4];
system.out.println(arr[4]);
}

a.编译错误

b.运行时异常

c.0

d.null

【正确答案】b
【答案解析】此题目考查的是java中的数组。
声明整型数组arr,包含4个元素,每个元素都是int型,默认值为0。
因为数组的下标从0开始,所以数组的最大下标为数组长度-1。所以在输出arr[4]的时候会出现数组下标越界的运行时异常,所以选项b是正确的。


 

| 
得分: 满分:2分

4、【单选题】

(单选题)在java中,一个源程序文件中定义了3个类,其中public修饰的类只能有()个。

a.0

b.1

c.2

d.3

【正确答案】b
【答案解析】此题目考查的是java中的类和对象。
在java语言中,一个源文件可以定义多个类,但是public修饰的类只能有一个,所以本题正确选项为b。

 

| 
得分: 满分:2分

5、【单选题】

(单选题)下列java代码的正确输出结果是()。
public class test {
public static void main(string[] args) {
aoo aoo = new aoo(5);
system.out.println(aoo.num);
}
}
class aoo{
int num;
public aoo(int num) {
num=num;
}
}

a.0

b.5

c.编译错误

d.运行异常

【正确答案】a
【答案解析】此题目考查的是java构造方法中给变量赋值。
本题中,在创建aoo对象时将5传递给aoo的有参构方法,在构造方法的num=num中,此时操作得都是局部变量num,与成员变量num没有关系,所以此时并没有给成员变量赋值,所以本题中成员变量num的值依然还是默认得0,本题选项a是正确的。


 

| 
得分: 满分:2分

6、【单选题】

(单选题)下列代码输出的结果是()
int sum = 0;
for (int i = 1; i 30) {
break;
}
}
system.out.println(sum);

a.120

b.48

c.45

d.30

【正确答案】c
【答案解析】该程序中 循环变量i的值从1开始,
循环内每次判断当前i的值对3取余是否为0,
如果为0则与当前sum变量的值相加,
如果不为0且当前sum变量的值大于30则退出当前循环。
第1次循环i的值为1,则if和else if的条件都不成立,
所以继续下一次循环。
第2次循环i的值为2,则if和else if的条件都不成立,
所以继续下一次循环。
第3次循环i的值为3,则if条件城里,所以执行sum += i,
此时sum的值变为3。然后继续下一次循环。
以此类推,sum的值是由所有对3取余为0的值相加所得,
且每次都要判断最新的sum的值是否大于30。
所以循环过程中sum值的变化应该是3、9、18、30、45 ...
当sum的值变为45时,此时超过了30,所以循环结束。
所以最后sum的值应该是45。

 

| 
得分: 满分:2分

7、【单选题】

(单选题)在java中,可以创建长度为4的数组对象的是()。

a.int[] arr = new int[];

b.int[] arr = new int(4);

c.int[] arr = new int[] { 12,34,56,78 };

d.int[] arr = new int[4] { 12,34,56,78 };

【正确答案】c
【答案解析】此题目考查的是java中的数组。
在java语言中,在创建数组中需要设定数组元素的个数,所以选项a是错误的。数组的元素个数需要放在中括号[]中,所以选项b也是错误的。创建数组直接给元素赋值时不能同时再设定元素个数。所以选项d是错误的。本题正确结果为c。


 

| 
得分: 满分:2分

8、【单选题】

(单选题)下列对方法的访问中,语法正确的是( )。

a.int i = 10;
static int j = 20;
void fun1(){}
static void fun2(){
fun1();
i++;
}

b.int i = 10;
static int j = 20;
void fun1(){}
static void fun2(){
fun1();
j++;
}

c.int i = 10;
static int j = 20;
void fun1(){
fun2();
i++;
}
static void fun2(){
i++;
}

d.int i = 10;
static int j = 20;
void fun1(){
fun2();
j++;
}
static void fun2(){}

【正确答案】d
【答案解析】本题目考查static修饰的方法,对类中成员的访问。
由于static在调用时没有具体的对象,因此在static方法中不能对非static成员
(对象成员)进行访问。
选项a,错误,static方法fun2()中访问了非静态成员i和fun1()。
选项b,错误,static方法fun2()中访问了非静态成员fun1()。
选项c,错误,static方法fun2()访问了非静态成员i。
选项d,正确,成员方法,可以访问类中所有的成员。


 

| 
得分: 满分:2分

9、【单选题】

(单选题)在java中, 以下()是public void test()的重载方法。

a.void test() { }

b.public int test() { }

c.public void test() { }

d.public void test(int num) { }

【正确答案】d
【答案解析】此题目考查的是java中方法的重载。
在java语言中,允许多个方法的名称相同,但参数列表不同,称之为方法的重载(overload)。重载与访问修饰符无关,也返回值类型无参。所以本题正确选项为d。

 

| 
得分: 满分:2分

10、【单选题】

(单选题)下列java代码运行的结果是()。
public class test {
public static void main(string[] args) {
aoo[] aoo = new aoo[2];
system.out.println(aoo[0]);
}
}
class aoo{
int x;
int y;
public aoo(int x, int y) {
this.x = x;
this.y = y;
}
}

a.0

b.null

c.编译错误

d.运行异常

【正确答案】b
【答案解析】此题目考查的是java中的引用类型数组。
aoo[] aoo = new aoo[2];此名创建的是aoo的数组对象,包含了2个元素,每个元素都是aoo类型的,默认值为null。接下来输出aoo[0]的值,即为默认的值null。所以本题正确选项为b。

 

| 
得分: 满分:2分

11、【单选题】

(单选题)java代码,如下:
class fu{
public void count(int i){
system.out.println(11/4);
}
}
public class zi extends fu{
public void count(int i){
system.out.println(11%i);
}
public static void main(string[]args){
fu fu = new zi( );
fu.count(4);
}
}
编译运行,结果是( )。

a.2

b.3

c.2.75

d.0

【正确答案】b
【答案解析】本题考查多态中的方法调用
父类型的引用,指向子类的对象,如果子类中重写了父类的方法,使用父类的引用调用被重写的方法的时候,此时该引用会与子类中的方法绑定,我们称为动态绑定。
因此,本题中执行的子类中的方法。11%4的运算是求模的运算,结果是3


 

| 
得分: 满分:2分

12、【单选题】

(单选题)给出以下代码,请问如何声明totalpage使其为一个只读属性( )。
public class page{
public int totalpage;
}

a.声明totalpage变量为private。

b.声明page类为private。

c.声明totalpage变量为private,并且建立一个用于获取totalpage变量值
的gettotalpage() 方法。

d.声明totalpage变量为static。

【正确答案】c
【答案解析】本题考查java类中只读属性的定义
只读属性需要使用private修饰,只能由类中提供的方法访问该属性,
类中需要提供形如public int gettotalpage(){return ...}的方法,方法中负责提供算法,返回属性对应的类型的值。
选项c正确

 

| 
得分: 满分:2分

13、【单选题】

(单选题)给出下面的代码段 :
public class base{
int w, x, y ,z;
public base(int a,int b) {
x=a; y=b;
}
public base(int a, int b, int c, int d) {
// ...
w=d;
z=c;
}
}
在代码// ... 处写入如下哪个代码是正确的?( )。

a.base(a,b);

b.x=a, y=b;

c.this(a);
this(b);

d.this(a,b);

【正确答案】d
【答案解析】本题考查this关键字的使用。
在构造函数中,调用构造函数的时候,必须使用this调用,而且必须是构造函数中的第一条语句,选项ac错误,选项b中,x=a必须使用分号结尾。选项d正确。

 

| 
得分: 满分:2分

14、【单选题】

(单选题)分析如下java代码,如果想在控制台上输出"b类的test()方法",
则在1处应填入( )。
class a {
public void test() {
system.out.println("a类的test()方法");
}
}
class b extends a {
public void test() {
system.out.println("b类的test()方法");
}
public static void main(string args[]) {
// 1
}
}

a.a a = new b();
a.test();

b.a a = new a();
a.test();

c.b b = new a();
b.test();

d.b.test();

【正确答案】a
【答案解析】本题考查面向对象的特性之一多态。
实现多态的条件是继承和重写,定义父类型的引用指向子类的对象
本题中类b继承了类a,子类中重写了父类的方法test()。
选项a,在继承和重写的前提下,父类a类型的引用变量a指向了子类
b创建的对象。a.test(),会调用子类中的test()方法,会满足题目要求
选项a正确。

 

| 
得分: 满分:2分

15、【单选题】

(单选题)下面的程序输出结果是( )。
public class a implements b {
int k = 20;
public static void main(string args[]) {
int i;
b c1 = new a();
i = c1.k;
system.out.println("i=" + i);
}
}
interface b {
int k = 10;
}

a.i=20

b.程序有编译错误

c.i=10

d.i=true

【正确答案】c
【答案解析】本题考查多态中的成员变量。
java中,成员变量是没有重写的,成员变量不可以被继承或覆盖,即不能实现多态。
只有方法才能构成多态。也就是说方法可以实现动态绑定,而变量用于是静态绑定。
所以本题中b c1 = new a(); i=c1.k;此时c1类型为b,与变量 int k = 10绑定
i值为10
选项c正确。

 

| 
得分: 满分:2分

16、【单选题】

(单选题)下列程序输出结果是( )。
public class test {
static int i = 0;
public int amethod() {
i++;
return i;
}
public static void main(string args[]) {
test test = new test();
test.amethod();
int j = test.amethod();
system.out.println(j);
test test1 = new test();
system.out.println(test1.i);
}
}

a.2
2

b.2
0

c.0
2

d.1
2

【正确答案】a
【答案解析】本题考查static修饰成员变量。
用static修饰的成员变量不属于对象的数据结构
static变量是属于类的变量,通常可以通过类名来引用static成员。
static成员变量和类的信息一起存储在方法区,而不是在堆中,一个类的static
成员变量只有“一份”,无论该类创建了多少个对象。
本题目中,调用了2次amethod()方法,成员变量i自增了2次,
所以j的值为2,输出2,而因为i是static成员变量,所有对象都共享
i=2的值,所以也输出2
选项a正确

 

| 
得分: 满分:2分

17、【单选题】

(单选题)下列程序运行结果是( )。
public class test {
string str=new string("tedu");
char[]ch={'x','y','z'};
public static void main(string args[]){
test t = new test();
t.change(t.str,t.ch);
system.out.print(t.str+" and ");
system.out.print(t.ch);}
public void change(string str,char ch[]){
str="tarena";
ch[0]='w';
}
}

a.tedu and xyz

b.tarena and xyz

c.tedu and wyz

d.tarena and wyz

【正确答案】c
【答案解析】本题考查方法的调用
调用带有引用数据类型参数的方法,传的是引用,当在方法中操作该引用,被传递的参数所指向的对象将发生变化。
本题中,调用change()方法,传递一个字符串类型引用,和数组对象的引用,方法中
将字符串引用重新指向了一个新的字符串对象,源字符串对象不会发生变化。还是
tedu,而方法中对数组的操作,改变了源数组中第1个元素,源数组被改变后为
wyz,所以本题选项c正确

 

| 
得分: 满分:2分

18、【单选题】

(单选题)在java中,下列程序的输出结果是( )。
class point {
int x;
boolean y;
void output(){
system.out.println(x);
system.out.println(y);
}
public static void main(string[] args) {
point point =new point();
point.output();
}
}

a.编译错误

b.0
true

c.0
false

d.0
0

【正确答案】c
【答案解析】本题考查成员变量默认初始化
成员变量会被默认的构造方法默认初始化,int默认值为0,boolean默认初始为false
值,选项c正确。


 

| 
得分: 满分:2分

19、【单选题】

(单选题)关键字abstract可以和下列( )关键字一起使用

a.final

b.private

c.public

d.static

【正确答案】c
【答案解析】本题考查abstract关键字
选项a错误,抽象方法必须被覆盖 ,而final后面的方法无法被覆盖
选项b错误,抽象方法必须被覆盖,私有的方法无法被覆盖 因为子类不可见
选项c正确。
选项d错误,静态可以直接被类名调用,调用抽象方法就没什么意义

 

| 
得分: 满分:2分

20、【单选题】

(单选题)java代码的运行结果是( )。
class account {
private string name; // 名字
private int state; // 账号状态
private string idcard; // 身份证号
public void account() {
name = "李强";
state = 0;
idcard = "109...";
system.out.println("执行构造方法。");}
public void show() {
system.out.println
("账务账号的名字是" + name + ",状态是"
+ state + ",身份证号是" + idcard + "。"); }
public static void main(string[] args) {
account acc = new account();
acc.show();}
}

a.账务账号的名字是null,状态是1,身份证号是109...。

b.执行构造方法。
账务账号的名字是null,状态是1,身份证号是null。

c.账务账号的名字是null,状态是0,身份证号是null。

d.执行构造方法。
账务账号的名字是李强,状态是1,身份证号是109...。

【正确答案】c
【答案解析】本题考查构造方法的特点和作用
构造方法必须与类名相同,没有返回值类型。如果没有定义构造方法,系统会提供无参
的构造方法。构造方法用来初始化成员变量和创建对象。当使用某个构造方法,创建对象的时候,系统会自动调用该构造方法。构造方法在初始化成员变量的时候,给成员变量添加初值。整型为0,字符串类型为null。本题中,定义的account()方法,与类名相同,但并非是构造方法,只是普通的方法。所以,该类中的成员变量还是默认的初值。
选项c正确

 

| 
得分: 满分:2分

21、【单选题】

(单选题)如下两个数组定义
char[] arr1 = {'a','c','d'};
char[] arr2 = {'g','h','j'};
能将两个数组正确合并的选项是( )。

a.int length = arr1.length+arr2.length;
char[] arr3 = new char[length];
system.arraycopy(arr1, 0, arr3, 0, arr1.length);
system.arraycopy(arr2, 0, arr3,0, arr2.length);

b.int length = arr1.length+arr2.length;
char[] arr3 = new char[length];
system.arraycopy(arr1, 0, arr3, 0, arr1.length);
system.arraycopy(arr2, 0, arr3,arr1.length-1, arr2.length);

c.int length = arr1.length+arr2.length;
char[] arr3 = new char[length];
system.arraycopy(arr1, 0, arr3, 0, arr1.length);
system.arraycopy(arr2, 0, arr3,arr1.length+1, arr2.length);

d.int length = arr1.length+arr2.length;
char[] arr3 = new char[length];
system.arraycopy(arr1, 0, arr3, 0, arr1.length);
system.arraycopy(arr2, 0, arr3,arr1.length, arr2.length)

【正确答案】d
【答案解析】本题考查数组拷贝的操作
arraycopy(src, srcpos, dest, destpos, length),system类中的方法,用于
拷贝数组元素
各个参数含义如下:
src 表示源数组
srcpos 表示从源数组哪个位置拷贝
dest 表示目标数组
destpos 从目标数组哪个位置拷贝
length 表示拷贝源数组元素的个数
选项a中,拷贝数组arr2的时候,覆盖了新数组中前3个元素,错误
选项b中,拷贝数组arr2的时候,覆盖了新数组中第3个元素,错误
选项c中,拷贝数组arr2的时候,从新数组下标4拷贝,拷贝3个元素,会出现越界异常,错误
选项d正确

 

| 
得分: 满分:2分

22、【单选题】

(单选题)下列运算结果正确的是( )。

a.int x = 4590;
x = x / 1000 *1000;
x的结果是4590

b.int x = 3;
x = x++;
x的结果是4

c.short x = 3;
x = x+4;
x的结果是7

d.int x = 2;
boolean b = x>3 && x

【正确答案】d
【答案解析】本题考查运算符的使用
选项a,java中整数的直接量都是int类型,两个整型相除,忽略余数,结果还是int类型,4590/1000结果是4,4*1000=4000,结果为4000,错误
选项b,程序的执行顺序先运算赋值运算,变量再自增,所以x的结果是3
选项c,编译错误

 

| 
得分: 满分:2分

23、【单选题】

(单选题)执行完下面程序片段后( )的结论是正确的。
int a, b, c;
a = 'a';
b = 'b';
c = (a + b > 180 ? a++ : b++);
// 已知字符'a',字符'b'对应的ascii值97,98

a.a=97,b=98,c=99

b.a=98,b=99,c=99

c.a=97,b=98,c=98

d.a=98,b=98,c=97

【正确答案】d
【答案解析】本题考查三目运算符,自增运算符和char
变量a,b初值分别是字符'a',字符'b'对应的ascii值97,98
所以a+b=97+98,结果为195,大于180成立,变量c的
结果为a++,因为是后++,先赋值再运算,c结果是97,之后
a再执行自增,变成98,而b++是不执行的
综上所述a=98 b=98 c=97
选项d正确


 

| 
得分: 满分:2分

24、【单选题】

(单选题)下列程序输出结果是( )。
int a = 0;
while (a

a.5

b.0

c.6

d.2

【正确答案】c
【答案解析】本题考查while循环和switch语句
a初值0,a

 

| 
得分: 满分:2分

25、【单选题】

(单选题)关于以下应用程序的说明,正确的是( )。
1. class staticclass
2. {
3. static int x=10;
4. static { x+=5;}
5. public static void main(string[] args)
6. {
7. system.out.println("x=" + x);
8. }
9. static { x/=3;}
10. }

a.4行与9行不能通过编译,因为缺少方法名和返回类型

b.9行不能通过编译,因为只能有一个静态初始化器

c.编译通过,执行结果为:x=5

d.编译通过,执行结果为:x=3

【正确答案】c
【答案解析】本题考查静态代码块
类中可以有多个static语句块,当类加载的时候依次执行
运行该应用程序的时候,先执行static{x+=5;},此时x值是15.
然后执行static{x/=3;},计算结果为x=15/3,结果为5
所以本题选项c正确。

 

| 
得分: 满分:2分

26、【单选题】

(单选题)下面代码输出结果是( )。
int x = 0, y = 0;
do {
if (x % 3 == 0) {
x++;
continue;
}
x++;
y = y + x;
} while (x

a.0

b.3

c.5

d.7

【正确答案】c
【答案解析】本题考查do-while循环
程序推演如下:
x=0,进入循环体,0%3等于0,满足if条件,x++,x值为1,执行continue,本次
循环结束,此时x=1,进入while表达式判断,x

 

| 
得分: 满分:2分

27、【单选题】

(单选题)给出以下代码,请问该程序输出( )结果。
class example{
static int i=1;
static {
++i;
}
public static void main (string[]args){
increment(i,5);
display(i);
}
static void increment(int n, int m){
n+=m;
}
static void display (int n) {
system.out.print(n);
}
static{
++i;
}
}

a.1

b.3

c.6

d.7

【正确答案】b
【答案解析】本题考查静态代码块。类执行即加载。静态代码块是类加载的时候自动执行。
类变量i在静态代码块中自增了2次,结果是3,而调用方法的时候,并没有改
变量i的值,只是将i的值传递到方法中。
选项b正确。


 

| 
得分: 满分:2分

28、【单选题】

(单选题)for循环语法格式如下:
for(表达式1;表达式2;表达式3){循环体}
以下说法正确的是:

a.每次循环都要执行表达式1

b.表达式2可以返回任何数据类型

c.3个表达式均可省略,使用如下格式for(;;){循环体}

d.循环体中必须有合法的java语句

【正确答案】c
【答案解析】本题考查for循环的使用
选项a,for循环的执行流程中,表达式1只执行一次,说法错误
选项b,表达式2必须返回boolean类型,用来判断循环是否继续执行,错误
选项c,可以省略3个表达式,构成一个死循环,正确
选项d,循环体中,可以没有任何java语句,满足语法要求,说法错误

 

| 
得分: 满分:2分

29、【单选题】

(单选题)将给定的数组变成如下格式的字符串,下列选项中,正确的是( )。
例如:[1,3,4]->"[1,2,3]"

a.string str = "[";
for (int x=0; x

b.string str = "[";
for (int x=0; x

c.string str = "[";
for (int x=0; x

d.string str = "[";
for (int x=0; x

【正确答案】c
【答案解析】该题目考查的是数组元素的遍历,通过for循环,
循环变量作为访问数组元素的下标,即可访问数组中
每一个元素,注意防止出现数组下标越界异常
a,d都会出现越界异常,b会丢失数组元素,c正确


 

| 
得分: 满分:2分

30、【单选题】

(单选题)下列程序输出结果是( )。
char c = 'a'; // 'a' 的int值为97
if(c>100){
system.out.println('a');
}else if(c>90){
system.out.println('b');
}else if(c>80){
system.out.println('c');
}else{
system.out.println('d');
}

a.a

b.b

c.c

d.d

【正确答案】b
【答案解析】本题考查if语句
if语句结构之一if...else if...else if.....else,此结构执行流程为,当出现表达式
结果为true,即执行语句体,整个if结构运行结束
本题中,char c = 'a',c对应的ascii值为97
97>90结果为true,打印字符b,其他语句体不再执行,选项b正确


 

| 
得分: 满分:2分

31、【多选题】

(多选题)下列正确的表达式是 ( )。

a.byte b = 128;

b.boolean b = null;

c.long l=0xfffl;

d.double d =0.9239d;

【正确答案】c,d
【答案解析】本题考查几种基本数据类型的赋值
选项a错误,byte类型最大值是127
选项b错误,boolean类型值只有true和false
选项c,d正确

 

| 
得分: 满分:2分

32、【多选题】

(多选题)对于如下类中的study()方法,请选择如下选项中,属于方法重载的是( )
public class student{
public string study(string content){}
}

a.public void study(int days){}

b.public string study(string content,string title){}

c.public string study(){}

d.public void study(string title){}

【正确答案】a,b,c
【答案解析】本题考查方法的重载
方法的重载必须满足方法名相同,参数不同(个数或类型不同),与方法的返回类型无关,本题四个选项,方法名都满足,d选项会报出重复的方法错误不是重载
选项abc都正确

 

| 
得分: 满分:2分

33、【多选题】

(多选题)下列属于java语言的特点是( )。

a.跨平台

b.支持多线程

c.面向对象

d.可以直接访问操作系统

【正确答案】a,b,c
【答案解析】java语言具备跨平台性、面向对象、安全性、多线程、简单易用等特性

 

| 
得分: 满分:2分

34、【多选题】

(多选题)java中的继承,如下说法正确的是( )。

a.java支持接口之间的多继承,也支持类之间的多继承。

b.java中只支持单继承,即一个类只能有一个父类.

c.当两个类存在所属关系(is a),才使用继承(is a,是一个。 说明该类是某类的一个特殊例子,简单之称为继承。)

d.使用继承,可以使类之间产生关系,提供了多态的特性。

【正确答案】b,c,d
【答案解析】选项a,错误,继承可以提高代码的复用,但是两个类之间,如果没有所属关系,不可以使用继承
选项bcd正确


 

| 
得分: 满分:2分

35、【多选题】

(多选题)下列对面向过程和面向对象描述正确的是( )

a.面向对象以功能为核心,使用函数封装。

b.面向过程以功能为核心,使用函数封装。

c.面向对象以事物为核心,将具体的数据和功能封装到事物中。

d.面向过程以事物为核心,将具体的数据和功能封装到事物中。

【正确答案】b,c
【答案解析】本题考查面向过程和面向对象的区别
“面向过程”是一种以过程为中心的编程思想。
就是分析出解决问题所需要的步骤,然后用函数把这些步骤一步一步实现,使用的时候一个一个依次调用就可以了。
面向过程其实是最为实际的一种思考方式,就是算面向对象的方法也是含有面向过程的思想.可以说面向过程是一种基础的方法.它考虑的是实际的实现.一般的面向过程是从上往下步步求精.所以面向过程最重要的是模块化的思想方法.
面向过程可以说是从细节处思考问题。
“面向对象”(object oriented,简称oo)是一种以事物为中心的编程思想。
面向对象的方法主要是把事物给对象化,对象包括属性与行为.当程序规模不是很大时,面向过程的方法还会体现出一种优势,因为程序的流程很清楚,按着模块与函数的方法可以很好的组织.面向对象也可以说是从宏观方面思考问题
选项bc正确


 

| 
得分: 满分:2分

36、【多选题】

(多选题)循环统计1到100之间能被7整除的整数的个数,
代码输出正确的是:()。

a.int y = 1;
int count = 0;
while(y

b.int y = 1;
int count = 0;
while(y

c.int count = 0;
for(int i=1;i

d.int count = 0;
for(int i=1;i

【正确答案】b,c
【答案解析】题目要求7的整数倍,所以应该选择模的运算
a,d选项都是除的运算

 

| 
得分: 满分:2分

37、【多选题】

(多选题)给出以下代码,请问该程序的运行结果是什么?
class a{
private int x=0;
static int y=1;
protected int z=2;
}
class b extends a{
void method(){
system.out.println(x);
system.out.println(y);
system.out.println(z);
}
}
下列说法正确的是( )。

a.程序编译错误,因为类b不能访问变量x。

b.程序编译成功,打印输出012。

c.程序编译错误,如果移走system.out.println(x)这条语句,
可使编译程序通过。

d.程序编译错误,因为变量x未在类b中定义。

【正确答案】a,c,d
【答案解析】本题考查java中几种访问修饰符
public:公共的,可以在任何类中访问
protected:受保护的,只能在同一个包中,或子类中访问
default:只能在同一个包中的类中访问
private:私有的,只能在本类中访问的
本题代码中,变量x是私有的,不能在类外部访问,acd正确。


 

| 
得分: 满分:2分

38、【多选题】

(多选题)对如下数组,说法正确的是( )。
int [] arr = {12,23,34,45,56,67};

a.获取数组中第三个元素的语法是arr[3]

b.获取数组中第三个元素的语法是arr[2]

c.该数组的最后一个元素的下标值为arr.length

d.该数组的最后一个元素的下标值为arr.length-1

【正确答案】b,d
【答案解析】该题目考查数组元素和长度的访问
数组中元素通过其下标访问语法为arr[0],
数组中元素下标从0开始,该题目中a,b
都是要求访问第三个元素,数组中第三个元素
下标为2,所以b正确。
数组元素下标从0开始,数组长度使用leng属性获取
所以最后一个元素的下标值为arr.length-1,d选项正确

 

| 
得分: 满分:2分

39、【多选题】

(多选题)下列关于jdk的说法正确的是( )

a.开发一个java程序,需要完整的jdk

b.运行一个java程序,需要完整的jdk

c.运行一个java程序,只需要jdk中的jre

d.以上说法都不对

【正确答案】a,c
【答案解析】本题考查jdk的组成和每个组成部分的功能
jdk是java语言的软件开发工具包,其中包括jre和一组开发工具
选项a,开发一个java程序,需要开发工具,所以需要完整的jdk,正确
选项b,运行一个java程序只需要jre 错误
选项c,运行一个java程序,只需要jdk中的jre 正确
选项d,a c 选项是正确的,所以该选项是错误的

 

| 
得分: 满分:2分

40、【多选题】

(多选题)下列选项中可以实现无限循环的是:()。

a.for(;;){}

b.while(true){}

c.do{}while(true);

d.for(int i=0;i++){}

【正确答案】a,b,c
【答案解析】此题考查无限循环的语法。
选项d有编译错误,缺少分号,不满足for循环的基本语法要求

 

| 
得分: 满分:2分

41、【多选题】

(多选题)如下变量的定义,double d = 1.5;int x=1,y=2,z=3;则正确的switch语句是( )

a.switch((int)d){
case 1:system.out.println(x);break;
case 2:system.out.println(y);break;
}

b.switch(d){
case 1.5:system.out.println(x);break;
case 2.0:system.out.println(y);break;
}

c.switch(x+y){
case 1:system.out.println(x);break;
case 2:system.out.println(y);break;
}

d.switch(x+y){
case 1:system.out.println(x);break;
case z:system.out.println(y);break;
}

【正确答案】a,c
【答案解析】本题考查switch结构的用法
switch语句中,表达式结果类型为byte,short,int,char,jdk1.7之后支持string类型
本题中选项b,变量d类型是double类型,错误。
case后必须使用常量,选项d中使用变量z,作为case选项,错误
选项a,将d强制转换成int类型符合语法要求 正确
选项c, x+y结果为int类型,case后都使用常量,满足语法要求,正确
所以正确答案ac


 

| 
得分: 满分:2分

42、【多选题】

(多选题)下列程序中不会出现编译错误的是( )

a.short s1 = 3;
short s2 = 5;
s1 += s2;

b.short s1 = 3;
short s2 = 5;
s1 = s1+s2;

c.short s1 = 3;
short s2 = 5;
s1 = s1 * s2;

d.short s1 = 3;
short s2 = 5;
s1 *= s2 ;

【正确答案】a,d
【答案解析】本题考查扩展赋值运算符。
java的扩展赋值运算符,+=,-=,*=,/=, %=
x+=y等价于x=x+y,其他同理。
除了以上语法现象外,使用扩展赋值运算符运算的时候,内部隐含强制转换。
如果出现需要类型转换,扩展赋值运算符直接进行转换。
选项b c都出现相同错误,计算结果都是int类型,都需要从int类型强制转换到short类型 选项ad都使用扩展赋值运算符运算,自动强制转换
ad正确


 

| 
得分: 满分:2分

43、【多选题】

(多选题)下列关于do....while循环说法正确的是:

a.do....while循环,循环体至少执行一次

b.do....while循环和while循环只是语法不同,没区别

c.do....while循环先执行循环体,再执行boolean表达式,如果为true再执行循环体

d.以上说法都正确

【正确答案】a,c
【答案解析】本题考查do....while循环的用法和while循环的区别。
while和do....while的区别如下:
while循环先判断再执行;
do....while循环先执行一次循环体,再判断。
当初始条件不满足循环条件时,while循环一次都不会执行;
do....while循环不管任何情况都至少执行一次,所以选项ac正确

 

| 
得分: 满分:2分

44、【多选题】

(多选题)下列关于成员变量默认值的描述中,正确的是( )。

a.byte类型的数据默认值是0

b.int类型的数据默认值是0

c.long类型的数据默认值是0

d.float类型的数据默认值是0.0f

【正确答案】a,b,d
【答案解析】本题考查基本类型的默认初值,long类型的默认初值是0l,
byte,int默认初值都是0
float默认初值是0.0f
选项abd正确。

 

| 
得分: 满分:2分

45、【多选题】

(多选题)下列选项中不会出现语法编译错误的是:()。

a.long l = 999999;

b.long l = 9999999999l;

c.byte b = 90+40;

d.int i = 'a'+'中';

【正确答案】a,b,d
【答案解析】a选项999999没有超出int类型取值范围,语法合法
b选项9999999999超出int类型取值范围,必须以字母l结尾
c选项90+40超出byte类型最大取值范围127,编译会报错
d选项两个char类型使用加的运算,使用编码值,结果为int类型

 

| 
得分: 满分:2分

46、【多选题】

(多选题)下列关于linux操作系统,描述正确的是( )。

a.linux 是一个开源的操作系统 是一个类似unix的操作系统

b.linux 是主流的服务器操作系统,广泛应用于互联网、云计算、智能手机等领域

c.linux 中的相对路径,使用“.”表示上一级目录,“..”表示当前路径

d.linux 中使用"pwd"命令显示当前工作目录的内容

【正确答案】a,b
【答案解析】本题考查对linux操作系统的基本了解和命令的使用
linux是一套免费使用和自由传播的类unix操作系统。它能运行主要的unix工具软件、应用程序和网络协议。它支持32位和64位硬件。linux继承了unix以网络为核心的设计思想,是一个开源的类unix的操作系统。a选项正确
linux操作系统诞生于1991 年10 月5 日(这是第一次正式向外公布时间)。linux存在着许多不同的linux版本,但它们都使用了linux内核。linux可安装在各种计算机硬件设备中,比如手机、平板电脑、路由器、视频游戏控制台、台式计算机、大型机和超级计算机,是主流的服务器操作系统 b选项正确
"."表示当前路径,“..”表示上一级路径 c选项错误
常用命令中,pwd用于显示当前工作目录 d选项错误


 

| 
得分: 满分:2分

47、【多选题】

(多选题)有以下代码
abstract class myabstractclass{
public abstract void m1(); //1
abstract protected void m2(){} //2
}
class mysubclass extends myabstractclass{
void m1(){} //3
protected void m2(){} //4
}
问:这段代码哪些地方有错误?( )

a.//1

b.//2

c.//3

d.//4

【正确答案】b,c
【答案解析】本题考查抽象方法,和子类实现父类的抽象方法
选项a,符合抽象方法的语法要求,没错误
选项b,使用abstract修饰的方法,为抽象方法,不能有方法体,会出现错误
选项c,子类实现父类中的抽象方法m1(),但是子类重写的方法访问修饰范围
不能低于父类方法的访问修饰,子类中默认的访问修饰范围低于父类的public
会出现错误
选项d,子类重写父类的抽象方法,给出了方法体,没错误
所以本题正确答案为bc,2,3处会出现错误。

 

| 
得分: 满分:2分

48、【多选题】

(多选题)java接口中定义方法,正确的是( )。

a.public void imethod();

b.void imethod();

c.protected void imethod();

d.private void imethod();

【正确答案】a,b
【答案解析】本题考查接口中的方法定义
接口中的方法默认都是public的,即使不使用public修饰,也是public的
选项a,b正确,
选项c,d错误,接口中的方法只能是public的,不能使用protected和private。


 

| 
得分: 满分:2分

49、【多选题】

(多选题)在java接口中,下列选项里有效的方法声明是( )。

a.protected void fun();

b.static void fun();

c.void fun();

d.public void fun();

【正确答案】c,d
【答案解析】本题考查接口中方法的定义
接口中的方法都是public的,即使不使用public修饰,默认也是public的
选项cd正确。


 

| 
得分: 满分:2分

50、【多选题】

(多选题)请选出属于jdk的组成部分( )。

a.支持java程序运行的一组类库

b.jvm

c.支持java程序开发的一组开发工具

d.一组软件测试工具

【正确答案】a,b,c
【答案解析】jdk:java开发工具集,包含java程序的运行环境和辅助java开发的一组开发工具。运行环境又包括一组类库和jvm

《java基础题月考JSD1908(含答案和解析).doc》

下载本文的Word格式文档,以方便收藏与打印。