0

How we can print the hello world in Java without using double quotes?

How we can print the hello world in Java without using double quotes?

19th Jun 2017, 5:12 AM
prajjawal gupta
2 Réponses
+ 1
Save it to a String variable then refer to the string variable. Or you can put it in an array of Characters, then make a loop to add all the characters to a string, then refer to the string. Or you can take user input and hopefully it's "Hello World" Or you can type in a whole alphabet in a String or Character array, then refer to specific characters to create the String "Hello World"
19th Jun 2017, 5:38 AM
Limitless
Limitless - avatar
+ 1
class CharArrayToString { public static void main(String args[]) { // Method 1: Using String object char[] ch = {'H', 'e', 'l', 'l', 'o ', ' w', 'o', 'r', 'l', 'd'}; String str = new String(ch); System.out.println(str); // Method 2: Using valueOf method String str2 = String.valueOf(ch); System.out.println(str2); } } output; Helloworld Helloworld
4th Aug 2017, 7:44 AM
jagadeesh reddy
jagadeesh reddy - avatar