Output and Printing Comments
Comments
-
@Ian, Sorry, the correct code is with a lowercase 'L', not an uppercase I:
System.out.println
. It stands for Print Line. -
Thanks, this same issue had me stumbled for both of the Array Loop Practices too.
-
You can complete the task with only one line: System.out.printIn([Some Stuff]);
-
I agree with Cliff, that is how I did it:
Hint:
string + variable + char -
nice article
-
I like it
-
It's just as simple as forgetting the exclamation point to be incorrect.
-
System.out.println("Hello " + name + "!");
-
@Sagar, please don't post the answers here. Instead you can link to your submission from the Submissions page.
-
I got all the results correct, and it says "Incorrect". Why ?
-
public static void doStuff(String name){
name = "Jim!";
String hi1 = "Hello ";
String hey1 = hi1 + name;
System.out.println(hey1);
name = "Sarah!";String hi2 = "Hello "; String hey2 = hi2 + name; System.out.println(hey2); name = "Tom!"; String hi3 = "Hello "; String hey3 = hi3 + name; System.out.println(hey3); name = "Harry!"; String hi4 = "Hello "; String hey4 = hi4 + name; System.out.println(hey4); }
Here is how I did it but still says Incorrect even though the Results are all Correct.
-
I don't quite understand this, can someone help me by explaining why
when I do
name = "Jim";
System.out.println("Hello " + name + '!');it prints four
Hello Jim
Hello Jim
Hello Jim
Hello JimI don't understand.
-
@AdhurimEsati, you are given the the String
name
each time as a parameter, you just need to print that. -
another simple solution :
System.out.println ("Hello "+name+"!"); -
import java.util.Scanner;
public class Main {
public static void main (String[] args){Scanner input= new Scanner (System.in); System.out.print ("Enter any Name: "); String name=input.nextLine(); System.out.println ("Hello " + name + "!"); }
}
-
import java.util.Scanner;
public class Main(){public static void main(String[] args){
String name="Nisha";
System.out.print("Hello" + name);
}
}
Ian
Nov 8, 6:37 PMpublic class Main {
public static void doStuff(String name){
name = name + "!";
String hello = "Hello ";
String message = hello + name;
System.out.printIn(message);
}
How come each input doesn't print out on their own line?