Menu
Topics Index
...
`

You like2527


If you need explanation Read this topic

If you need Answer Take test on this topic

You like2527
What will be the output of the following program?
import java.util.*;
public class ILike {
    public static void main(String[] args) {
        String like;
        Formatter convert = new Formatter();
        convert.format("pen");
        convert.format("~pencil");
        like = convert;
        System.out.println(like);
    }
}

A. ~pencil
B. pen~pencil
C. Compilation Error
D. Runtime Error
Topic: Java Formatter Methods

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.

c is ans... we can not assign a object  to of Formatter class to String..

Posted by Sareesh Rayapati    2014-08-06 12:49:44


Ans is C.
we cannot assign Formatter object to a String referrence.

Posted by Gopinath Manchikanti    2014-08-06 14:00:05


c

Posted by Deepika Deepu    2014-08-06 15:16:49


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

Posted by Merit Campus    2014-08-07 04:47:23


© meritcampus 2019

All Rights Reserved.

Open In App