What will be the output of the following Java program?
class String_demo
{
public static void main(String args[])
{
int ascii[] = { 65, 66, 67, 68};
String s = new String(ascii, 1, 3);
System.out.println(s);
}
}
a) ABC
b) BCD
c) CDA
d) ABCD
Answer: b
Explanation: ascii is an array of integers which contains ascii codes of Characters A, B, C, D. String(ascii, 1, 3) is an constructor which initializes s with Characters corresponding to ascii codes stored in array ascii, starting position being given by 1 & ending position by 3, Thus s stores BCD.
output:
BCD
Related Posts
Consider a transaction T1 that committed prior to checkpoint. The <T1 commits> record appears in the log before the <checkpoint> record. Any modifications made by T1 must have been written to the stable storage either with the checkpoint or prior to it. Thus at recovery time ____________
The system periodically performs checkpoints that consists of the following operation(s) ____________
The undo and redo operations must be _________ to guarantee correct behaviour, even if a failure occurs during recovery process.
An actual update is not allowed to a data item ____________
In the write ahead logging a _____________ is maintained.
Write ahead logging is a way ____________
The state of the data accessed by an aborted transaction must be restored to what it was just before the transaction started executing. This restoration is known as ________ of transaction.
Join The Discussion