Questions tagged [println]

In programming, `println` generally prints out the arguments given, then moves to a new line for subsequent output.

In programming, println generally outputs the arguments supplied, then moves to a new line for any further output operations. For example, in Java you could write the following:

System.out.print("Hello ");
System.out.println("World");
System.out.println("Goodbye");

And the console would output (with \n representing newline characters):

Hello World\n
Goodbye\n

There are several languages that use the println() method; Others have different syntax that accomplishes the same functionality.

617 questions
1
vote
1 answer

Java - Not displaying print statement before getting user input with scanner (NetBeans issue?)

I'm trying to do a very simple user input in NetBeans 12.6 where I ask a question and have the user respond to it. Everything works fine when I use System.out.println("QUESTION") to display the question, but the code does not behave properly when I…
Ryan
  • 21
  • 1
1
vote
2 answers

Parse Output of Child Process

In Java, I am launching a child process like so: String[] command = {"java", "-jar", jarPath}; Process childProcess = new ProcessBuilder().inheritIO().command(command).start(); I expect the child process to print Success! to standard output at some…
Software Dev
  • 910
  • 3
  • 10
  • 27
1
vote
3 answers

Queries on System.Out.Println

I have a question pertaining the method in the java, I have checked for online resources but i could not get the answer that i wanted. I would like to know why the "out" and "println" in the statement below has to be in lowercase letters…
ray
  • 11
  • 1
1
vote
0 answers

Rust std::fmt isn't working like expected

I want to print the following: ->2 A1 B1 Test but my code produces an different output: println!("{:5}{}{:5}{:5}{}", 2, 'A', 1, "B1", "Test"); -> 2A 1B1 Test what am I doing wrong?
Simon Rechermann
  • 467
  • 3
  • 18
1
vote
2 answers

Why does in Java using Println or Print affect the order of execution of code?

I am very new to Java and have been trying to figure out this question. Why does taking an input after print and taking it after println differ the order of execution. Scanner input = new Scanner(System.in); System.out.println("Enter…
Smaran Das
  • 11
  • 1
1
vote
1 answer

Content from variable and object of my Node Instance isn't getting printed out

Note The program works just fine, the thing is when trying to print the dictionary tree out, it doesn't print the word itself: +++++Spanisch Woerterbuch+++++++ Bitte waehlen Sie eine Aktion aus! Einfuegen 2. Suchen 3. Beenden 1 Bitte…
TorbenIT
  • 259
  • 2
  • 12
1
vote
0 answers

Strange redirection to stderr with println in Kotlin

I do not understand if this is intentional, but if the message in println starts with Error, the output will be redirected to stderr instead of stdout. Example: val a = "abc" println("NotError: $a") // to stdout println("Error: $a") // to stderr I…
1
vote
4 answers

Java println: Windows vs Linux

I have a java program that writes a file to a remote machine file system using the jcifs library -samba stuff; SmbFile=>SmbFileOutputStream=>PrintStream and the I use the common println(String). Everything worked fine till I moved my application to…
Marsellus Wallace
  • 17,991
  • 25
  • 90
  • 154
1
vote
3 answers

String not getting printed in the output

String r1 = "hello"; String r2 = "hello"; System.out.println("Result: " + r1 == r2); I tried running this code and i am not getting the String output in the console. The only value getting printed is the r1==r2 result i.e false. The question here…
1
vote
3 answers

Rust println! prints weird characters under certain circumstances

I'm trying to write a short program (short enough that it has a simple main function). First, I should list the dependency in the cargo.toml file: [dependencies] passwords = {version = "3.1.3", features = ["crypto"]} Then when I use the crate in…
Trec Apps
  • 221
  • 2
  • 9
1
vote
0 answers

Print 2D array - Diferent results Eclipse and PowerShell java

Basically I have a simple App that you insert the dimensions (x,y) of your 2D array and it will print its border on the console. For example, if you insert 2 2 it will print: ---- | | | | ---- This prints correctly in the Eclipse console and for…
James May
  • 11
  • 3
1
vote
0 answers

Why that causes an extra empty line for my out put if the input didnt end up with an digit in JAVA

Hi I'm a student who studing this and my teacher ask us to wrote a progame that could get the correct output. The request is the input will always start with an integer k, and after the first input there will be k lines of String followed. that…
ErieStary
  • 11
  • 2
1
vote
2 answers

Can I output the same amount of floating numbers in double that it number has in printf()?

class Test { public static void main(String[] args) { double arr[] = {1.2, 1.23, 1.234, 1.2345}; System.out.printf("%f %f %f %f", arr[0], arr[1], arr[2], arr[3]); } } For example if I don't know how many numbers there…
Denys_newbie
  • 1,140
  • 5
  • 15
1
vote
1 answer

How can I read text in front of a print! message?

I'm trying to make a program that reads any word on the command line and prints it on a new line that's all, what I'm trying to do is something like this: Some text: hello But instead I get something like this: Some text: Hello Since using print!…
1
vote
2 answers

anyway to rearrange a arraylist and remove printline

Hi I have to write a program that takes in number of candidate and how many votes they got from the best to the worst. And I wrote two different classes to do that using a fileInputStream and another that uses the scanner class and storing it in the…
chuck finley
  • 459
  • 3
  • 8
  • 16