Menu
Topics Index
...
`

Print account details


If you need explanation Read this topic

If you need Answer Take test on this topic

Print account details
What will be the output of the following program?
public class BankAccountInf {
    public static void main(String[] args) {
        int accountNumber = 401;
        double bankBal = 1029.939;
        String name = "Goutham";
        String print = name.concat("'s account number is ").concat(String.valueOf(accountNumber));
        print = ("-bank bal is ").concat(String.valueOf(bankBal));
        System.out.println(print);
    }
}

A. Goutham's account number is 401-bank bal is 1029.939
B. -bank bal is 1029.939
C. Compilation Error
D. Runtime Error
Topic: Data Conversion Using valueOf In Java

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

Ans:B in first print variable " account number is 401" will be stored. then in second print variable is ovverridden with " -bank bal is 1029.939"

Posted by Indrasena Reddy    2014-01-22 04:15:59


Congratulations Indrasena Reddy . You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-01-23 04:10:39


© meritcampus 2019

All Rights Reserved.

Open In App