Menu
Question Index
...

What will be the output of the following program?

public class Quiz
{
    public static void main(String[] args)
    {
        String str = "Dpnqvufs-";
        byte[] bytes = str.getBytes();
        for (byte byt : bytes)
        {
            System.out.print(((char)(int)(char)(char)(int)(int)(char)(int)(int)((char)byt - 1)) + " ");
        }
    }
}


D p n q r u f s -
67 111 109 112 113 116 101 114 44
B n l o t s d q +
C o m p u t e r ,
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