Menu
Question Index
...

What will be the output of the following program?

public class ByteExample
{
    public static void main(String[] args)
    {
        String str = "Merit";
        System.out.println((int) 'X');
        byte[] bytes = str.getBytes();
        for (byte byt : bytes)
            System.out.print(byt + " ");
    }
}


88
M e r i t
88
77 101 114 105 116
X
M e r i t
X
77 101 114 105 116
Compilation Error or Runtime Error

Doubts

Problems

Topic: Java Character Extraction - Java String getBytes() Method

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App