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
5
votes
2 answers

Recursively print struct in `fmt::Display`

I'm currently in the process of implementing fmt::Display for a struct so that it will print out to the console. However The struct has a field which is a Vec of it's type. Struct pub struct Node<'a> { pub start_tag: &'a str, pub end_tag:…
XAMPPRocky
  • 3,160
  • 5
  • 25
  • 45
5
votes
2 answers

Formatting Long and Double in Scala println

What's the suffix after '%' I should use in order to format a Long or a Double type variables? var LONG : Long = 9L; println("The value of LONG is %?".format(LONG)); var DOUBLE : Double = 9.9; println("The value of DOUBLE is…
Jes
  • 2,614
  • 4
  • 25
  • 45
5
votes
2 answers

Where do System.out.println() messages go, when it is called in client-side GWT-module?

When I write messages to log (i.e. com.allen_sauer.gwt.log.client.Log#debug) I can see them in Chrome->F12->Console or (during debug) in IDEA->Debug->Dev Mode. But if the System.out.println() was used in IDEA the messages appear in the same place as…
niralittle
  • 114
  • 1
  • 3
  • 9
5
votes
3 answers

How can I support println in a class?

What does my own made class need to support in order for println() to print it? For example, I have: public class A { ... } What methods should class A have to make this code work? Maybe something like this: public static void main() { A a =…
D3migod
  • 299
  • 3
  • 13
5
votes
1 answer

Optional("var") in println

I got the Problem if i try print a var i sometimes get a "Optional("var")" if i try log it or print it to a lable, but else when i dont get it. See here ViewController.swift import UIKit class ViewController: UIViewController { override func…
Fabian Boulegue
  • 6,476
  • 14
  • 47
  • 72
5
votes
1 answer

Scala String Interpolation in println - Accessing elements using dot notation

I have a user object with a few properties that I can access using dot notation. For example, user.fullName outputs a String like Firstname Lastname. How do I access these properties within a println statement that uses string interpolation? I've…
dbau
  • 16,009
  • 2
  • 21
  • 31
5
votes
2 answers

Console of my Android Studio does not print the log message

I created a Hello, World project in Android Studio to test using System.out.println(). I believe the log message should be printed in the console, but it wasn't. Im using Android Studio AI-130.737825 with JRE:1.7.0_25. The test code follows: package…
lu yuan
  • 7,207
  • 9
  • 44
  • 78
5
votes
1 answer

Can we print a java message on console without using main method, static variable and static method?

public class Test { /** * @param args */ // 1st way public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("Test....!!!!!"); } // 2nd…
Ravi
  • 169
  • 1
  • 2
  • 6
5
votes
1 answer

Display Items from a Database in a JavaFX TableView

Ok, so I'm new to this, and I've been searching for two weeks trying to get an SQL resultset to print to a TableView made by JavaFX Scene Builder. I can print my resultset using System.out.println and the data is correct, but when I try put it into…
John
  • 165
  • 2
  • 3
  • 15
4
votes
2 answers

Java - why won't char '+' appear on the console?

I am making a simple calculator and here is my code. public static void main(String[] args) { int x = 3; int y = 7; char w = '+'; System.out.println(x+w+y+"="+(x+y)); } The result appears as '53 = 10' and I don't get why '+'…
Nari
  • 49
  • 7
4
votes
3 answers

Interface for println(String)

I'd like to write Java code (say, a method) that will print some lines. The object onto which to print shall be provided by the caller. I'd like my code to not care what exactly that object is and simply call that objects' println() or…
das-g
  • 9,718
  • 4
  • 38
  • 80
4
votes
1 answer

How to make the print method in Kotlin have the same effect as Java

I tried this code below in Kotlin. The print method cache the input data until I call the println method. >>> print(1) >>> print(2) >>> System.out.print(3) >>> System.out.print(4) >>> println(5) 12345 I'd like to print the number as a sequence…
Trần Đức Tâm
  • 4,037
  • 3
  • 30
  • 58
4
votes
6 answers

System.out.println not functioning

What are some scenarios in which java's System.out.println would fail to produce any output. I have a call to it inside of a method and sometimes when the method is called I get the println and othertimes I don't. Update: I am also using…
lathomas64
  • 1,612
  • 5
  • 21
  • 47
4
votes
2 answers

What's the order of this Go print statements?

I'm taking 'A Tour of GO' tutorial about Golang and this code: package main import ( "fmt" "math" ) func pow(x, n, lim float64) float64 { if v := math.Pow(x, n); v < lim { return v } else { fmt.Printf("%g >= %g\n",…
codybythesea
  • 77
  • 1
  • 7
4
votes
10 answers

Core java printing statement

Why does java compiler gives 100a as output when I ever tried to print System.out.println('2'+'2'+"a") and a22 for System.out.println("a"+'2'+'2'). Please explain in detail . thank you)
jaga D sh
  • 81
  • 6