




版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領
文檔簡介
》》》》》》歷年考試真題——2025年最新整理《《《《《《》》》》》》歷年考試真題——2025年最新整理《《《《《《/》》》》》》歷年考試真題——2025年最新整理《《《《《《上海\o"查看:德邦java面試題"德邦物流股份有限公司招聘java面試真題一、選擇題(20)
[含多選]。(請在正確的答案上打”√”)Question
1)Which
of
the
following
statements
are
true?1)
An
interface
can
only
contain
method
and
not
variables2)
Interfaces
cannot
have
constructors3)
A
class
may
extend
only
one
other
class
and
implement
only
one
interface4)
Interfaces
are
the
Java
approach
to
addressing
its
lack
of
multiple
inheritance,
but
require
implementing
classes
to
create
the
functionality
of
the
Interfaces.Question
2)Which
of
the
following
statements
are
true?1)
The
garbage
collection
algorithm
in
Java
is
vendor
implemented2)
The
size
of
primitives
is
platform
dependent3)
The
default
type
for
a
numerical
literal
with
decimal
component
is
a
float.4)
You
can
modify
the
value
in
an
Instance
of
the
Integer
class
with
the
setValue
methodQuestion
3)Which
of
the
following
are
true
statements?1)
I/O
in
Java
can
only
be
performed
using
the
Listener
classes2)
The
RandomAccessFile
class
allows
you
to
move
directly
to
any
point
a
file.3)
The
creation
of
a
named
instance
of
the
File
class
creates
a
matching
file
in
the
underlying
operating
system
only
when
the
close
method
is
called.4)
The
characteristics
of
an
instance
of
the
File
class
such
as
the
directory
separator,
depend
on
the
current
underlying
operating
systemQuestion
4)What
will
happen
when
you
attempt
to
compile
and
run
the
following
codeclass
Base{public
void
Base(){System.out.println(“Base”);}}public
class
In
extends
Base{public
static
void
main(String
argv[]){In
i=new
In();}}1)
Compile
time
error
Base
is
a
keyword2)
Compilation
and
no
output
at
runtime3)
Output
of
Base4)
Runtime
error
Base
has
no
valid
constructorQuestion
5)You
have
a
public
class
called
myclass
with
the
main
method
defined
as
followspublic
static
void
main(String
parm[]){System.out.println(parm[0]);}If
you
attempt
to
compile
the
class
and
run
the
program
as
followsjava
myclass
helloWhat
will
happen?1)
Compile
time
error,
main
is
not
correctly
defined2)
Run
time
error,
main
is
not
correctly
defined3)
Compilation
and
output
of
java4)
Compilation
and
output
of
hello
Question
6)Which
of
the
following
statements
are
NOT
true?1)
If
a
class
has
any
abstract
methods
it
must
be
declared
abstract
itself.2)
When
applied
to
a
class,
the
final
modifier
means
it
cannot
be
sub-classed3)
All
methods
in
an
abstract
class
must
be
declared
as
abstract4)
transient
and
volatile
are
Java
modifiersQuestion
7)What
will
happen
when
you
attempt
to
compile
and
run
the
following
class?class
Base{Base(int
i){System.out.println(“Base”);}}class
Severn
extends
Base{public
static
void
main(String
argv[]){Severn
s
=
new
Severn();}void
Severn(){System.out.println(“Severn”);}}1)
Compilation
and
output
of
the
string
”Severn”
at
runtime2)
Compilation
and
no
output
at
runtime3)
Compile
time
error4)
Compilation
and
output
of
the
string
”Base”Question
8)Which
of
the
following
statements
are
true?1)
Static
methods
cannot
be
overriden
to
be
non
static2)
Static
methods
cannot
be
declared
as
private3)
Private
methods
cannot
be
overloaded4)
An
overloaded
method
cannot
throw
exceptions
not
checked
in
the
base
classQuestion
9)Which
of
the
following
statements
are
true?1)
The
automatic
garbage
collection
of
the
JVM
prevents
programs
from
ever
running
outof
memory2)
A
program
can
suggest
that
garbage
collection
be
performed
but
not
force
it3)
Garbage
collection
is
platform
independent4)
An
object
becomes
eligible
for
garbage
collection
when
all
references
denoting
it
are
set
to
null.Question
10)Given
the
following
codepublic
class
Sytch{int
x=2000;public
static
void
main(String
argv[]){System.out.println(“Ms
”+argv[1]+”Please
pay
$”+x);}}What
will
happen
if
you
attempt
to
compile
and
run
this
code
with
the
command
linejava
Sytch
Jones
Diggle1)
Compilation
and
output
of
Ms
Diggle
Please
pay
$20002)
Compile
time
error3)
Compilation
and
output
of
Ms
Jones
Please
pay
$20004)
Compilation
but
runtime
errorQuestion
11)You
need
to
read
in
the
lines
of
a
large
text
file
containing
tens
of
megabytes
of
data.
Which
of
the
following
would
be
most
suitable
for
reading
in
such
a
file1)
new
FileInputStream(“”)2)
new
InputStreamReader(new
FileInputStream(“”))3)
new
BufferedReader(new
InputStreamReader(new
FileInputStream(“”)));4)
new
RandomAccessFile
raf=new
RandomAccessFile(“myfile.txt”,”+rw”);Question
12)Which
of
the
following
statements
are
true?1)
Constructors
cannot
have
a
visibility
modifier2)
Constructors
are
not
inherited3)
Constructors
can
only
have
a
primitive
return
type4)
Constructors
can
be
marked
public
and
protected,
but
not
privateQuestion
13)Which
statement
is
true?
1)An
anonymous
inner
class
may
be
declared
as
final.
2)An
anonymous
inner
class
can
be
declared
as
private.
3)An
anonymous
inner
class
can
implement
multiple
interfaces
.
4)An
anonymous
inner
class
can
access
final
variables
in
any
enclosing
scope.
5)Construction
of
an
instance
of
a
static
inner
class
requires
an
instance
of
the
enclosing
outer
class.Question
14)public
class
Foo{public
static
void
main(String
sgf[]){StringBuffer
a
=
new
StringBuffer(“A”);
StringBuffer
b
=
new
StringBuffer(“B”);
operate(a,b);
System.out.println(a+”,”+b);
}
static
void
operate(StringBuffer
x,StringBuffer
y){x.append(y);
y=x;
}}
What
is
the
result?
1)The
code
compiles
and
prints
“A.B”.
2)The
code
compiles
and
prints
“A.A”.
3)The
code
compiles
and
prints
“B.B”.
4)The
code
compiles
and
prints
“AB.B”.
5)The
code
compiles
and
prints
“AB.AB”.Question
15)Which
of
the
following
thread
state
transitions
are
valid?
1)
From
ready
to
running.
2)
From
running
to
ready.
3)
From
running
to
waiting.
4)
From
waiting
to
running.
5)
From
waiting
to
ready.
6)
From
ready
to
waiting.Question
16)What
is
the
result
of
attempting
to
compile
and
run
the
following
program?public
class
Test
{private
int
i
=
j;
private
int
j
=
10;
public
static
void
main(String
args[])
{System.out.println((new
Test()).i);
}}
1)
Compiler
error
complaining
about
access
restriction
of
private
variables
of
Test.
2)
Compiler
error
complaining
about
forward
referencing.
3)
No
error
-
The
output
is
0;
4)
No
error
-
The
output
is
10;Question
17)Which
two
cannot
directly
cause
a
thread
to
stop
executing?
1)exiting
from
a
synchronized
block
2)calling
the
wait
method
on
an
object
3)calling
the
notify
method
on
an
object
4)calling
a
read
method
on
an
InputStream
object
5)calling
the
setPriority
method
on
a
thread
objectQuestion
18)Which
of
the
following
are
correct,
if
you
compile
the
following
code?public
class
CloseWindow
extends
Frame
implements
WindowListener
{public
CloseWindow()
{addWindowListener(this);
//
This
is
listener
registration
setSize(300,
300);
setVisible(true);
}public
void
windowClosing(WindowEvent
e)
{System.exit(0);
}
public
static
void
main(String
args[])
{CloseWindow
CW
=
new
CloseWindow();
}
}1)
Compile
time
error
2)
Run
time
error
3)
Code
compiles
but
Frames
does
not
listen
to
WindowEvents
4)
Compile
and
runs
successfullyQuestion
19)Which
statements
describe
guaranteed
behavior
of
the
garbage
collection
and
finalization
mechanisms?1)
Objects
are
deleted
when
they
can
no
longer
be
accessed
through
any
reference.
2)
The
finalize()
method
will
eventually
be
called
on
every
object.
3)
The
finalize()
method
will
never
be
called
more
than
once
on
an
object.
4)
An
object
will
not
be
garbage
collected
as
long
as
it
is
possible
for
an
active
part
of
the
program
to
access
it
through
a
reference.
5)
The
garbage
collector
will
use
a
mark
and
sweep
algorithm.Question
20)A
class
design
requires
that
a
member
variable
should
be
accessible
only
by
same
package,which
modifer
word
should
be
used?1)
protected2)
public3)
no
modifer4)
private二.簡答題。(80)
(請注意字跡填寫工整)2.1
說明
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 嵌入式設備調(diào)試方法試題及答案
- 網(wǎng)絡云計算技術測驗題及答案
- 數(shù)據(jù)庫開發(fā)中的協(xié)作工具與資源管理試題及答案
- 行政組織理論中的協(xié)同效應分析試題及答案
- 公路工程考試面臨的知識更新挑戰(zhàn)試題及答案
- 突破2025年軟件測試工程師考試難度試題及答案
- 行政組織考試的系統(tǒng)化試題及答案
- 行政組織考試的備考指南試題及答案
- 專項公路工程復習試題及答案
- 整體把握的信息系統(tǒng)監(jiān)理師考試試題及答案
- 外科經(jīng)典換藥術
- 義項和義素-課件
- 水文地質(zhì)學基礎 15.地下水與環(huán)境
- 地質(zhì)災害治理工程施工質(zhì)量驗收表
- 葫蘆島市白狼山新一代天氣雷達塔樓及配套基礎設施建設項目環(huán)評報告
- 出版專業(yè)基礎知識中級
- 2023-2024學年云南省開遠市小學數(shù)學三年級下冊期末深度自測考試題
- 新時代三會一課(講解)
- GB/T 9115.1-2000平面、突面對焊鋼制管法蘭
- 教輔資料進校園審批制度
- 2023年廣東省初中生物地理學業(yè)考試真題集合試卷及答案高清版匯總
評論
0/150
提交評論