java月考题JSD1908第二次月考(含答案和解析)
考试
.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;
}
/* 表单元素 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 100px 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、【单选题】
A.0
B.1
C.2
D.3
Java中,字符串底层个是由字符数组构成,而每个字符占用内存2个字节
选项C正确。
|
得分: 满分:2分
2、【单选题】
public class Cell{
private int row;
private int col;
//getter()和setter()
}
能够通过该类中的row属性,比较该类多个对象的大小,可以实现的接口是( )。
A.List
B.Iterator
C.Comparable
D.Map
类通过实现Comparable接口,并重写接口中compareTo()方法,
可以实现对该类的多个对象进行比较
选项C正确。
|
得分: 满分:2分
3、【单选题】
返回的类型是( )。
A.boolean
B.String
C.int
D.char
valueOf()方法将基本数据类型转换成字符串类型
选项B正确
|
得分: 满分:2分
4、【单选题】
A.yield
B.sleep
C.run
D.setPrority
Thread类中定义了setPrority()方法,用来设置线程的优先级。
选项D正确。
|
得分: 满分:2分
5、【单选题】
// 已知 'T' 的int值为84,'t' 的int值为116
String s1="TEDU",s2="tedu";
System.out.println(s1.compareTo(s2));
A.-32
B.32
C.false
D.true
String 类实现了Comparable接口,并实现了compareTo()方法
方法在实现中,将两个字符串内容中的字符进行ASCII码值减的操作,
从前往后减,如果第一个字符相同,就操作第二个字符,再次减,直到
运行到不相同的字符,将结果返回,如果字符内容和大小写都相同,则返回0
本题程序中,字符‘T’-‘t’值为-32。
选项A正确。
|
得分: 满分:2分
6、【单选题】
A.start()
B.run()
C.sleep()
D.wait()
选项A 用于启动线程
选项C用来休眠线程
选项D让某个线程处于等待状态
选项B正确。
|
得分: 满分:2分
7、【单选题】
1 public class TestEquals{
2 public static void main(String[]args){
3 String str1=new String("TEDU");
4 String str2=new String("tedu");
5 if(str1.equals(str2)){
6 System.out.println("Equal");
7 }
8 }
9 }
该程序的执行结果是( )。
A.程序执行后无输出
B.程序执行后输出“Equal”
C.程序在第5行出现编译错误
D.程序执行后出现异常
boolean equals(Object object);重写自父类Object的equals()方法。
在String类中,用于区分大小写的比较两个字符串内部字符是否相同。
本题中创建2个字符串对象,str1与str2对象的字符内容大小写不同
所以str1.equals(str2)返回false,不执行if语句体,所以没有任何内容输出
选项A正确
|
得分: 满分:2分
8、【单选题】
A.MIN_PRIORITY
B.MAX_PRIORITY
C.NORM_PRIORITY
D.NORMAL_PRIORITY
线程的优先级被划为10级,值分别是1-10,其中1最低,10最高。
线程提供了3个常量来表示最低、最高、以及默认优先级
分别是Thread.MIN_PRIORITY, Thread.MAX_PRIORITY, Thread.NORM_PRIORITY
选项D不是,本题选择D。
|
得分: 满分:2分
9、【单选题】
A.BufferedOutputStream bos =
new BufferedOutputStream(new FileWriter(""));
B.BufferedOutputStream bos =
new BufferedOutputStream(new FileOutputStream("fileName"));
C.BufferedOutputStream bos =
new BufferedOutputStream("fileName");
D.BufferedOutputStream bos =
new BufferedOutputStream(new File("fileName"));
BufferedOutputStream是字节输出缓冲流。java中缓冲流需要套接
一个基本文件流,才能创建流对象,选项CD错误
BufferedOutputStream是字节输出缓冲流,必须套接一个字节输出流
选项A套接的是一个字符输出流,错误
选项B正确
|
得分: 满分:2分
10、【单选题】
BufferedOutputStream bos =
new BufferedOutputStream(
new FileOutputStream("bos.txt"));
bos.write("hello");
假设bos.txt不存在,运行该程序段后,文件bos.txt的字节数为:
A.5
B.10
C.4
D.0
缓冲流执行写的操作,只是将内容写入到缓冲区中,并没有真正写入文件
所以程序执行后,文件中并没有数据,要想真正写入数据需要调用flush()方法。
选项D正确。
|
得分: 满分:2分
11、【单选题】
StringBuffer buf=new StringBuffer("TEDU2016");
buf.insert(4,"@");
System.out.println(buf.toString());
A.TEDU@2016
B.@TEDU2016
C.TEDU2016@
D.TED@U2008
StringBuffer insert(int index,String str);在index索引处插入字符串str
本题中字符U索引值为3,insert(4,"@"),即为在U后插入字符@
结果是TEDU@2016,选项A正确。
|
得分: 满分:2分
12、【单选题】
A.getState()
B.isAlive()
C.isDaemon()
D.isRun()
选项A 获取线程的状态
选项B 测试线程是否处于活动状态
选项C 测试线程是否为守护线程
选项D 没有改方法
选项B正确。
|
得分: 满分:2分
13、【单选题】
A.undefined
B.""
C.0
D.null
字符串类型成员变量默认初值为null,选项D正确
|
得分: 满分:2分
14、【单选题】
A.StringBuilder类的对象调用tostring()方法将转换为String类型
B.两个类都有append()方法
C.可以直接将字符串“test”赋值给声明的Stirng类和StringBuilder类的变量
D.两个类的实例的值都能够被改变
选项A正确,toString()方法,即是转换到字符串类型的方法。
选项B错误,String类没有append()方法
选项C错误,StringBuilder类不能直接赋值
选项D错误,字符串对象一旦创建,内容不可变
|
得分: 满分:2分
15、【单选题】
public static void main(String[] args) {
StringBuilder str = new StringBuilder("abc");
int result = getResult(str);
System.out.println(result);
}
public static int getResult(StringBuilder str){
str.append("abc");
str.delete(0,3);
str.insert(0, "abc");
str.replace(0,3, "abc");
return str.length();
}
A.0
B.5
C.6
D.9
本题自定义方法中用到了如下几个StringBuilder方法。
append();追加字符,运行后结果为"abcabc"
delete(0,3);删除0,1,2,3个字符,不包括索引值为3的字符,运行后结果"abc"
insert(0,"abc");从开头插入abc3个字符,运行后结果为"abcabc"
replace(0,3,"abc"),将原内容的0,1,2,的字符替换为abc,结果为"abcabc"
运行结束后内容为"abcabc"
length()方法用于获取字符数,所以结果是6
选项C正确
|
得分: 满分:2分
16、【单选题】
class Emp{
private int empNo;
private String ename;
public int getEmpNo() {
return empNo;
}
public void setEmpNo(int empNo) {
this.empNo = empNo;
}
public String getEname() {
return ename;
}
public void setEname(String ename) {
this.ename = ename;
}
public int hashCode() {
return empNo;
}
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Emp other = (Emp) obj;
if (empNo != other.empNo)
return false;
return true;
}
public static void main(String[] args) {
Emp e1 = new Emp();
e1.setEmpNo(1001);
e1.setEname("刘苍松");
Emp e2 = new Emp();
e2.setEmpNo(1001);
e2.setEname("Robin");
System.out.println(e1==e2);
System.out.println(e1.equals(e2));
}
}
运行该类,输出结果是( );
A.false false
B.false true
C.true false
D.true true
Object类中默认equals()方法和==没有区别,本类中重写了equals()方法,如果empNo相同,两个Emp对象的equals()方法,即会返回true。
选项B正确。
|
得分: 满分:2分
17、【单选题】
A.createNewFile();
B.createNewFiles();
C.mkdir();
D.mkdirs();
选项A错误,createNewFile();用来创建文件
选项B错误,File类中没有该方法
选项C错误,mkdir()用于创建当前目录
选项D正确。
|
得分: 满分:2分
18、【单选题】
代码1处应该添加的代码是:( )。
File file = new File("c://java");
File[] files = file.listFiles(/*1*/);
A.不需要任何代码
B.".java"
C.new FileFilter{
public boolean accept(File file) {
return file.getName().endsWith(".java");
}
}
D.new FileFilter() {
public boolean accept(File file) {
return file.getName().endsWith(".java");
}
}
listFiles()方法用于获取某抽象路径中所有的文件和目录。选项A错误。
选项B错误,没有改方法
本题要求获取.java文件,那么该方法需要传入一个实现了FileFilter
接口的类的一个对象,FileFilter用于过滤路径中的文件,可以使用
匿名内部类实现。选项C中缺失小括号
选项D正确。
|
得分: 满分:2分
19、【单选题】
try {
RandomAccessFile raf
= new RandomAccessFile("c:/a.txt", "rw");
raf.write('A');
raf.writeInt(300);
System.out.println(raf.getFilePointer());
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
该程序输出的结果是( )。
A.1
B.2
C.4
D.5
raf.write('A');写入2个字节,文件指针从0开始,此时raf.getFilePointer()结果是1
raf.writeInt(300);写入一个int,4个字节,指针指向5
选项D正确。
|
得分: 满分:2分
20、【单选题】
String str1 = "TEDU";
String str2 = "TEDU";
String str3 = new String("TEDU");
System.out.println(str1==str2);
System.out.println(str1==str3);
A.true true
B.true false;
C.false false
D.false true
Java为了提高性能,静态字符串(字面量、常量、常量连接)在常量池中创建,
并尽量使用同一个对象,重用静态字符串。对于重复出现的字符串直接量,JVM
会首先在常量池中查找,如果存在即返回该对象。
使用new方式创建的字符串对象,不会缓存在String常量池中。
本题中str1,str2都指向内容相同的字符串常量,str1==str2结果为true
str3指向使用new创建的对象,str1==str3结果为false
选项B正确
|
得分: 满分:2分
21、【单选题】
Map map=new HashMap();
map.put("tom",123.6);
map.put("jim",234.5);
map.put("jerry",45.3);
《插入代码》
《插入代码》处要实现的功能是把
key为"jim"的value值在原有数字的基础上加100
正确的是( )。
A.map.put("jim",map.get("jim")+100);
B.map.set("jim",map.get("jim")+100);
C.map.put("jim",234.5);
D.map.set("jim",234.5);
Map中的key值不能相同,如果想修改Map中某个元素的vlaue值
即为向Map中添加key相同,value不同的元素,即是覆盖原来的元素
选项BD错误,Map集合中没有set方法。
选项AC语法正确,C没有完成需求,没有加100
选项A正确。
|
得分: 满分:2分
22、【单选题】
A.对元素进行遍历,依次比较
B.对内容有序的List可以进行二分法查找
C.调用indexOf方法查找
D.无论是否有序都可以用二分法查找,比线性查找快很多
选项D说法不正确,二分查找法,必须是对有序的元素。
|
得分: 满分:2分
23、【单选题】
public class Test01 {
public static void main(String[] args)throws Exception {
Thread t = new Thread(/*code here*/);
t.start();
}
}
A.new Runnable()
B.new Runnable {
public void run() {
//..
}
}
C.new Runnable() {
public void run() {
//..
}
}
D.new Thread {
public void run() {
//..
}
}
选项A错误,Runnable是接口不能直接创建对象。
选项B错误,new Runnable后缺少小括号。
选项C正确。
选项D错误,new Thread后缺少小括号。
|
得分: 满分:2分
24、【单选题】
public class Cell implemens Comparable{
int row;
int col;
//getter()和setter()
//code here
}
//若要cell类对象能在TreeSet集合中按特定要求排序,code here处,需要添加的代码段是()。
A.public void compareTo(Cell o){
this.row - o.row;
}
B.public boolean compareTo(Cell o){
return this.row > o.row;
}
C.public int compareTo(Cell o){
return this.row - o.row;
}
D.public int compareTo(Object o){
return this.row - o.row;
}
compareTo()方法的定义格式为int compareTo(Object o);
如果在实现接口的给定了泛型,方法中的参数即为传入泛型的参数类型
选项A,B方法的返回值类型错误。
选项D,方法中的参数应该是Cell,因为类实现接口的时候给出了Cell类型
因此,选项C正确。
|
得分: 满分:2分
25、【单选题】
public class Test01{
public static void main(String[] args) {
try {
test();
System.out.println("1...");
} catch (ArithmeticException e) {
System.out.println("2...");
} catch (Exception e) {
System.out.println("3...");
} finally {
System.out.println("end...");
}
}
public static void test() {
String str = "cc";
str.compareTo("abc");
}
}
输出的结果是:()。
A.1...
end...
B.2...
end...
C.2...
3...
end...
D.1...
2...
3...
end...
当程序没有异常执行try和finally语句块
当程序出现异常,结束try语句块,程序跳到对应的异常类型的catch语句块
中执行,再执行finally语句块。
本题目中,try语句块中没有异常出现,全部语句都执行,然后执行finally语句块
选项A正确。
|
得分: 满分:2分
26、【单选题】
A.1
B.2
C.3
D.4
Java为了提高性能,静态字符串(字面量、常量、常量连接)在常量池中创建,并尽量使用同一个对象,重用静态字符串。对于重复出现的字符串直接量,JVM会首先在常量池中查找,如果存在即返回该对象。
本题中"TEDU"是一个对象,"tedu"是一个对象,变量与常量拼接,会产生新的对象
选项C正确。
|
得分: 满分:2分
27、【单选题】
通过下列程序获取到三个名字。
程序如下:
String[] names =( );
for (int i = 0; i
A.split(",",str)
B.str.split(",")
C.str.toArray(",")
D.Arrays.toArray(str,",");
本题完成将一个字符串拆分的功能,String类中提供了一个String[] split(",")
方法,根据特定的分隔符,返回一个字符串数组。
并遍历该数组,打印数组中每个元素。
|
得分: 满分:2分
28、【单选题】
ArrayList list = new ArrayList();
list.add("java");
list.add("aaa");
list.add("java");
list.add("java");
list.add("bbb");
下面可以删除list中所有的"java"的代码是( )。
A.for (int i = list.size() - 1; i >= 0; i--){
if ("java".equals(list.get(i))) {
list.remove(i);
}
}
B.for (int i = 0; i
C.list.remove("java");
D.list.removeAll("java");
|
得分: 满分:2分
29、【单选题】
定义方法,对字符串中的字符进行排序。
例如字符串“bcdefag”排序后结果:"abcdefg";
A.public void sortString(String str){
char [] arr = str.toCharArray();
Arrays.sort(arr);
String temp = String.valueOf(arr);
return temp;
}
B.public String sortString(String str){
char [] arr = str.toCharArray();
Arrays.sort(arr);
String temp = String.valueOf(arr);
System.out.println(temp);
}
C.字符串对象,创建之后,内容不可改变,以上需求不合理,无法实现。
D.public String sortString(String str){
char [] arr = str.toCharArray();
Arrays.sort(arr);
String newString = String.valueOf(arr);
return newString;
}
本题需求定义一个方法实现,根据需求,
确定方法返回值为排序后的新的字符串对象,方法返回类型为String
方法中需要一个不确定的字符串对象,参与运算,方法的参数为一个字符串对象
所以方法应该为形如public String method(String str){}
方法中实现字符排序的思路如下:
1、根据源字符串生成字符数组,使用toCharArray()方法
2、对字符数组排序,使用Arrays工具类中的sort()方法
3、将排序后的字符数组,转换成字符串对象,使用valueOf()方法
4、将新的字符串对象返回,方法中必须使用return语句.
选项A,定义返回值类型为void的方法,方法不允许使用return返回值,错误
选项B,定义返回值类型为String的方法,方法必须有return语句返回值,错误
选项C,字符串对象不可改变,改变之后会产生新的对象,需求是可以实现的,错误
选项D,符合方法定义语法,内部实现可以完成需求,正确。
|
得分: 满分:2分
30、【单选题】
《插入代码》处应填入的代码是( )。
ArrayList list = new ArrayList();
list.add("刘苍松");
list.add("范传奇");
list.add("王克晶");
《插入代码》
A.Iterator it = list.iterator();
while(it.hasNext()){
it.next();
it.remove();
}
B.Iterator it = list.iterator();
while(it.hasNext()){
it.remove();
}
C.Iterator it = list.iterator();
while(it. hasNext()){
String str = it.next();
list.remove(str);
}
D.Iterator it = list.iterator();
while(it.hasNext()){
list.remove();
}
Iterator可以迭代集合,迭代期间,不能通过集合对象,删除集合中元素
如果通过集合对象删除,程序在运行期间会抛出异常。选项CD错误
Iterator可以迭代集合,迭代期间,不能通过集合对象,删除集合中元素
但是可以通过迭代器Iterator对象删除集合中元素,需要迭代一个元素
删除一个元素,选项A正确。
选项B没有迭代元素,直接删除,会抛出异常。
|
得分: 满分:2分
31、【单选题】
String s1 ="ab";
String s2 ="abcd";
String s3="cd";
String s4 =s1+s3;
s1=s4;
System.out.println("s1"+((s1==s2)?"==":"!=")+"s2");
A.s1==s2
B.s1!=s2
C.s1
D.s1=="abcd"
String s4 = s1+s3,会产生新的对象。String s2 = "abcd",s2是常量池中的一个对象,
s2==s4,返回false,s1=s4,s1指向常量池中“abcd”对象,所以s1!=s2
选项B正确。
|
得分: 满分:2分
32、【单选题】
public int getSubCount(String str,String substr){
int count = 0;
int index = 0;
while((index = str.indexOf(substr, index))!=-1){
count++;
index =____________________________________________;
}
return count;
}
完成如上功能,空白处应该填写( )。
A.index + substr.length();
B.index + str.length();
C.index + substr.size();
D.index + str.size();
次数。
定义方法的思路如下:
1、确定方法的返回值类型
如何确定方法的返回类型?根据需求,功能中需要有运算结果,结果为子串出现的
次数,返回int类型。
2、确定方法的参数列表
如何确定方法的参数列表?分析功能中是否有不确定的数据参与运算。本题需求中
计算的某个字符串中,子串出现的次数,所以有两个字符串类型的参数,一个用于
查找的字符串,一个查找哪一个子串。
根据以上思路定义出方法为:public int subString(String str,String subStr){};
方法中,需要使用循环依次查找子串,出现依次,计数变量自增1,直到找不到
子串,循环结束。
当查找到有一个子串,就从该子串的下一个位置继续查找。
所以空白处应该使用index+strSub.length();
选项A正确。
|
得分: 满分:2分
33、【单选题】
public class Cell{
int row;
int col;
public Cell(){}
public Cell(int row,int col){
this.row = row;
this.col = col;
}
public static void main(String args[]){
List cells = new ArrayList();
cells.add(new Cell(2,3));
cells.add(new Cell(5,1));
cells.add(new Cell(3,2));
//对该集合中对象进行排序
Collections.sort(cells,
//插入代码
);
}
}
A.new Comparator(){
public int compare(Cell c1,Cell c2){
return c1.row - c2.row;
}
}
B.new Comparator(){
public boolean compare(Cell c1,Cell c2){
return c1.row > c2.row;
}
}
C.new Comparator{
public int compare(Cell c1,Cell c2){
return c1.row - c2.row;
}
}
D.new Comparator{
public boolean compare(Cell c1,Cell c2){
return c1.row > c2.row;
}
}
Collections工具类中,sort方法,根据特定的比较规则
对集合中的元素进行排序。调用sort方法需要传入一个实现了Comparator接口
的实现类对象。也可以直接使用匿名内部类的方式实现。
Comparator接口中的compare()方法返回int类型,选项BD错误
匿名内部类的格式为:new Comparator(){//...},选项A正确
|
得分: 满分:2分
34、【单选题】
public class Fu{
public void play() throws IOException{
//...
}
}
A.public class Zi extends Fu{
void play() throws IOException{
//...
}
}
B.public class Zi extends Fu{
void play() throws Exception{
//...
}
}
C.public class Zi extends Fu{
public void play() throws IOException{
//...
}
}
D.public class Zi extends Fu{
public void play() throws Exception{
//...
}
}
子类重写父类的方法,方法的修饰符权限必须大于或等于父类方法的修饰符
选项AB错误
子类重写父类的方法,方法声明的异常类型必须与父类相同或是父类中方法
声明异常类型的子类型。D错误
选项C正确。
|
得分: 满分:2分
35、【单选题】
List list = new ArrayList();
list.add("aaa");
list.add("aaa");
list.add("aaa");
list.add("aaa");
迭代该集合中的元素,下列待填入处应补充的是( )。
for(/*待填入*/){
System.out.print(str);
}
A.List list : String str
B.String str : List list
C.list : String str
D.String str : list
增强的for循环使用如下:
For(String str : list){.....}
选项D正确
|
得分: 满分:2分
36、【单选题】
File file = new File("c://a.txt");
if(/*1*/){
try {
/*2*/
} catch (IOException e) {
e.printStackTrace();
}
}
A.!file.exists();
file.createNewFile();
B.!file.exists();
file.mkdir();
C.File!=null
file.createNewFile();
D.file.isDirectory()
file.createNewFile();
判断文件是否存在的方法是:exists();
创建文件的方法是:createNewFile();
选项A正确
|
得分: 满分:2分
37、【单选题】
应该填入的代码是( )。
public static void main(String[] args) {
char[] ch = { 'a', 'c', 'a', 'b', 'c', 'b' };
HashMap map = new HashMap();
for (int i = 0; i
A.if (map.contains(ch[i])) {
map.put(ch[i], map.get(ch[i]) + 1);
}else{
map.put(ch[i], 1);
}
B.if (map.contains(ch[i])) {
map.put(ch[i], (Integer) map.get(ch[i]) + 1);
} else {
map.put(ch[i], 1);
}
C.if (map.containsKey(ch[i])) {
map.put(ch[i], (int) map.get(ch[i]) + 1);
} else {
map.put(ch[i], 1);
}
D.if (map.containsKey(ch[i])) {
map.put(ch[i], (Integer) map.get(ch[i]) + 1);
} else {
map.put(ch[i], 1);
}
选项A,B都错误,HashMap中没有contains()方法。
选项C,map中元素都是对象,不能强制转换为int类型
选项D正确。
|
得分: 满分:2分
38、【单选题】
String s= "Tedu V W ";
char c=s.charAt(8);
A.null
B.' '
C.编译错误
D.'W '
char charAt(int index);String 类中的方法,返回索引值为index的字符
字符串中字符的索引值从0开始,本题索引值8的字符为空格
选项B正确
|
得分: 满分:2分
39、【单选题】
A.class Card{
public boolean toString(){
return false;
}
}
B.class Card{
public int toString(){
return 0;
}
}
C.class Card{
public String toString(){
return "";
}
}
D.class Card{
public Object toString(){
return null;
}
}
|
得分: 满分:2分
40、【单选题】
A.ArrayList
B.StringBuilder
C.HashMap
D.Hashtable
ArrayList和HashMap都是非线程安全的
Vector和Hashtable都是线程安全的。
|
得分: 满分:2分
41、【多选题】
A.str的长度是15
B.str的长度是14
C.str.indexOf("a")返回的结果是3
D.str.lastIndexOf("e")返回的结果是3
|
得分: 满分:2分
42、【多选题】
A.与数组不同,集合框架是容量可变的容器
B.集合框架不能保存基本类型,但是可以将它们转换为包装类后保存
C.集合框架中的List, Set, Map接口都是Collection接口的子接口
D.集合类除了提供可变容量的存储外,还提供了对数据的算法
选项C错误,Map接口不是Collection接口的子接口。
|
得分: 满分:2分
43、【多选题】
A.异常是定义了程序中遇到的可恢复的错误,而不是编译时的语法错误
B.try……catch语句中对try 内语句监测,如果发生异常,则把异常信息放入Exception类的对象中
C.throws 用来表示一个方法有可能抛出异常给上一层,则在调用该方法时可以捕捉或抛出异常,否则无法编译通过
D.main方法不可以使用 throws 抛出异常
选项D错误,任何方法都可以抛出异常。
|
得分: 满分:2分
44、【多选题】
A.class Test01 {
public static void main(String[] args)throws Exception {
Thread t1 = new Thread1();
t1.run();
}
}
class Thread1 extends Thread{
public void run() {
System.out.println("haha");
}
}
B.class Test01 {
public static void main(String[] args)throws Exception {
Thread t1 = new Thread1();
t1.start();
}
}
class Thread1 extends Thread{
public void run() {
System.out.println("haha");
}
}
C.class Test01 {
public static void main(String[] args)throws Exception {
Thread t = new Thread(new Thread1());
t.start();
}
}
class Thread1 implements Runnable{
public void run() {
System.out.println("haha");
}
}
D.class Test01 {
public static void main(String[] args)throws Exception {
Thread t = new Thread(new Thread1());
t.run();
}
}
class Thread1 implements Runnable{
public void run() {
System.out.println("haha");
}
}
创建线程类可以继承Threa类,此时需要重写run()方法,来指定该线程任务。
通过该类直接创建的对象即为一个线程对象。
创建线程类还可以实现Runnable接口,通过创建该类对象,实例化某个线程
的线程功能。再通过该对象,传递给Thread类对象的构造器参数,来创建线程。
启动线程,通过线程对象调用start()方法来启动线程
选项AD都错在启动线程的方法错误,不是run()方法,而是start()方法。
选项BC正确。
|
得分: 满分:2分
45、【多选题】
A.使用DOM的方式解析文档,只能实现对XML的读取而不能写出XML数据。
B.DOM方式在解析XML文档时,需要将整个文档全部加载到内存中。
C.SAX解析方式的效率优于DOM的方式。
D.使用DOM4j组件对XML解析时,可以支持XPath查找。
选项A 错误,DOM提供了对XML读取和写出的操作。
|
得分: 满分:2分
46、【多选题】
A.ArrayList
B.StringBuilder
C.HashTable
D.StringBuffer
选项CD正确。
|
得分: 满分:2分
47、【多选题】
A.^\d{5,}$
B.^[1-9][0-9]{4,8}$
C.^[1-9]\d{4,}$
D.^[1-9][0-9]{4,}$
选项CD正确。
|
得分: 满分:2分
48、【多选题】
A.线程就是程序
B.线程是一个程序的单个执行单元
C.多线程是指一个程序的多个执行单元
D.多线程用于实现并发
选项A错误。进程中所包含的一个或多个执行单元,称为线程。
多线程能够使多个执行单元并发执行。
|
得分: 满分:2分
49、【多选题】
A."1az098".matches("\\d[a-z]{2,8}[0-9]+")
结果为true
B."1az098".matches("\\d[a-z]{2,8}[0-9]+")
结果为false
C."张三,,,李四,,王五,,,,,,马六,,".split("[,]+").length == 1;
该表达式结果返回true
D."张三,,,李四,,王五,,,,,,马六,,".split("[,]+").length == 4;
该表达式结果返回true
String类中的matches()方法和split()方法都支持正则表达式。
matches()方法用于判断已知字符串是否匹配某个正则
split()方法用于根据正则拆分字符串
选项A,B正则“\\d[a-z]{2,8}[0-9]+”表示1位数字开头,2~8位字母,1位或多位数字,字符串"1az098"匹配正确,选项A正确
选项C,D 正则"[,]+"表示1位或多位逗号字符,split()方法,使用1位或多位逗号字符
为分隔符拆分字符串,拆分后字符串数组中为4个元素,选项D正确
选项A,D正确
|
得分: 满分:2分
50、【多选题】
A.^[0-9]{6}$
B.^\d{6}$
C.^[0~9]{6}$
D.^\D{6}$
正则表示任意数字:[0-9]或\d,选项CD错误,{6}表示6位,选项AB均正确。
java月考题JSD1908第二次月考(含答案和解析)的更多相关文章
- java基础题月考JSD1908(含答案和解析)
考试 .container { clear: both; margin: 0 auto; text-align: left; /*width: 1200px;*/ } .container:after ...
- 精心整理Java微服务最全面试题集(含答案)
微服务架构相关 大型网站架构演变过程 网站架构演变演变过程 传统架构 → 分布式架构 → SOA架构 → 微服务架构 什么是分布式架构 分布式架构就是将传统结构按照模块进行拆分,不同的人负责不同的模块 ...
- java中String类的面试题大全含答案
1.下面程序的运行结果是()(选择一项)String str1="hello";String str2=new String("hello");System.o ...
- java笔试手写算法面试题大全含答案
1.统计一篇英文文章单词个数.public class WordCounting {public static void main(String[] args) {try(FileReader fr ...
- python 全栈开发,Day43(python全栈11期月考题)
python全栈11期月考题 1.常用字符串格式化有哪些?并说明他们的区别 2.请手写一个单例模式(面试题) 3.利用 python 打印前一天的本地时间,格式为‘2018-01-30’(面试题) 4 ...
- 【¥200代金券、iPad等您来拿】 阿里云9大产品免费公测#10月9日-11月6日#
#10.09-11.06#200元代金券.iPad大奖, 9大产品评测活动! 亲爱的阿里云小伙伴们: 云产品的多样性(更多的云产品)也是让用户深度使用云计算的关键.今年阿里云产品线越来越丰富,小云搜罗 ...
- 武汉Uber优步司机奖励政策(12月28日到1月3日)
滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...
- 青岛Uber优步司机奖励政策(12月28日到1月3日)
滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...
- 南京Uber优步司机奖励政策(12月28日到1月3日)
滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...
随机推荐
- Selenium+Java(一)Selenium基础环境配置
前言 Selenium在Java中是以Jar包的形式存在,如要使用Java编写Selenium自动化测试用例,需要导入Jar包. selenium需要的Jar包下载地址: http://seleniu ...
- Error : Program type already present: android.support.design.widget.CoordinatorLayout$
背景 因为公司一个app项目需要扩展,因为功能较多且较完整的流程与业务,而且和以前的业务关系不大,所以我整合到了 另外一个分包中(代号:newFunc,请注意是代号)进行依赖. 当我写完这部分业务开始 ...
- kubernetes实战(二十九):Kubernetes RBAC实现不同用户在不同Namespace的不同权限
1.基本说明 在生产环境使用k8s以后,大部分应用都实现了高可用,不仅降低了维护成本,也简化了很多应用的部署成本,但是同时也带来了诸多问题.比如开发可能需要查看自己的应用状态.连接信息.日志.执行命令 ...
- 关于新浪和腾讯短网址API接口的调用
最新新浪t.cn短网址和腾讯url.cn短网址生成api接口,快速生成t.cn及url.cn超短链接,接口都可以正常调用,觉得不错可以收藏一下. 新浪短网址api接口:1. http://yldwz. ...
- 修改json源码支持datetime序列化
修改json源码支持datetime序列化 import json import datetime now = datetime.datetime.today() json.dumps(now) 抛出 ...
- VisualStudio2012编辑器错误
https://blogs.msdn.microsoft.com/webdev/2014/11/11/dialog-box-may-be-displayed-to-users-when-opening ...
- Linux下搭建web服务
第一:安装java 第二:安装tomcat 第三:部署程序 第一:安装java 下载地址: http://www.oracle.com/technetwork/java/javase/download ...
- 第八次作业-非确定的自动机NFA确定化为DFA
NFA 确定化为 DFA 子集法: f(q,a)={q1,q2,…,qn},状态集的子集 将{q1,q2,…,qn}看做一个状态A,去记录NFA读入输入符号之后可能达到的所有状态的集合. 步骤: 1. ...
- bundle 的生成和使用
一.bundle 的生成 1.打开XCode,创建iOS版用的bundle资源包,有两种方式:第一种直接将工作,open in finder.在目录中直接新建文件夹,文件夹以bundle格式.文件夹 ...
- 七种CSS左侧固定,右侧自适应两栏布局
一 两栏布局基本HTML和CSS 首先创建基本的HTML布局和最基本的样式. 基本的样式是,两个盒子相距20px, 左侧盒子宽120px,右侧盒子宽度自适应 <div class="w ...