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

Java println() of integers?

I want to print the two integer variables divided. int a = 1, b = 2; System.out.println(a + b); Obviously println() function processes them as integers and calculates the sum. Instead I would like the output becomes like this "12". Any ideas?
c jais
  • 11
  • 1
-1
votes
2 answers

How do I change the display of date of birth in java?

In my Java code, date of birth is retrieved from a database in the format 1999-04-30. How can I out.println this in a different format? Like this: 30/04/1999
html
  • 33
  • 3
-1
votes
2 answers

How do I make this get method for array lists simpler?

import java.util.*; public class ChristmasParty { private Scanner input = new Scanner(System.in); public static void main(String[] args) { ChristmasParty cp = new ChristmasParty(); cp.run(); } public void…
-1
votes
1 answer

Printing out body parts for hangman game to console

I am currently making a hangman game in Java as a learning experience because I am fairly new to the Java language. I've done this project before in Python when I was first learning that and am now basically mirroring it in Java. Most hangman games…
RobertR
  • 745
  • 9
  • 27
-1
votes
2 answers

JAVA PrintWriter println method

I am trying to use the println method of PrintWriter to write the following to a single line: 100,iPod,Book,100 The types of the above are: Int, String, String, double,respectively. Can someone please tell me how this can be accomplished? Thanks.
CircAnalyzer
  • 610
  • 1
  • 9
  • 29
-1
votes
1 answer

None of the print commands produce output, but the program still executes without errors java- eclipse

I'm studying Java and am obviously very new to it. I have what appears to be a working application, however it doesn't produce any output to the console window as expected - it also doesn't give any errors which is baffling. I'm using Eclipse. I…
jdev-01
  • 3
  • 4
-1
votes
2 answers

Why system.out.println changes reflects without building jar?

I am using maven as a build tool and running some integration-test cases. I logged some statements in my test case using System.out.println() and did a mvn verify and even i didn't clean install/package the jar.The changes were reflecting for…
Anand Kadhi
  • 1,790
  • 4
  • 27
  • 40
-1
votes
1 answer

Java while loop

So my homework assignment is to prompt a user to input a positive integer value, and use a while loop to make sure the value is not negative. Once the value is positive, the program should print out the input value as the number of lines with 2…
m3manny
  • 1
  • 1
-1
votes
2 answers

Why do I get a compilation error when calling println method in the class body? #Java

class Test { int a = 100; System.out.println(a); } class Demo { public static void main(String args[]) { Test t = new Test(); } } I'm new to programming. I found this code when I'm practicing. I don't understand why I'm…
Dhanuka
  • 2,826
  • 5
  • 27
  • 38
-1
votes
2 answers

display the value of bool in swift

I would like to print the result of the bool value When I do it I have "true" instead the amount. I know it probably sounds really stupid but I'm just getting started with swift var monthsWeek:Int? var hoursWageHours:Double = 14.47 let…
Kevin
  • 1,076
  • 4
  • 22
  • 49
-1
votes
2 answers

How to print out inputted ArrayList

I'm trying to print out what I inputted for my ArrayList but I keep getting weird results such as this [player@42a57993, player@75b84c92, player@6bc7c054] when I clearly put in legitimate names. So take a look at my code and see what the problem…
-1
votes
1 answer

Java sql doesnt show data without empty println

I am using the following code from the internet to get data from a database: ResultSet rs = statement.executeQuery(); ResultSetMetaData rsmd = rs.getMetaData(); System.out.println("querying SELECT * FROM XXX"); int columnsNumber =…
Randy
  • 9,419
  • 5
  • 39
  • 56
-1
votes
3 answers

No output from System.out.println in method

import java.util.Scanner; public class RentalDemo { public static void main (String[] args) { Scanner input = new Scanner (System.in); String cnumber; String outnumber; Rental first=new Rental(); …
Michael
  • 3
  • 3
-1
votes
1 answer

Why is there difference between out.println and err.println?

System.class contains "out" and "err" object of Printstream class. System.class is declared static. println() is a overloaded method in Printstream class which have (out and err objects) if we execute System.out.println("Xys"); and…
-1
votes
7 answers

Why won't this println command start a new line?

Here's the relevant code: public static void printBoarders (Territory x) { int t = 0 ; int n = 0 ; for (int i = 0; i
David
  • 14,569
  • 34
  • 78
  • 107