using textpad w/ jdk

When trying to use single print line:

System.out.println("\n" + var1,"\n" + var2);

I get error:

symbol : method println(java.lang.String,java.lang.String)
location: class java.io.PrintStream
System.out.println("\n" + var1,"\n" + var2);

I understand that \n is new line, and My instructor told me to just use + "Integer name"
for my previous program that checked if it was even or odd, but that case only had one
integer variable to print. Trying to add two is why is confusing me. I know java is not C++, but If If I placed that command in C++ like:

cout << "\n" << var1 << "\n" << var2 <<endl;

it would work, but what is the equivalent in java?

//Enter a Five digit Number and program will seperate
//into individual numbers


import java.util.Scanner;

public class SeperateNumbers // Start of class Seperate Numbers
{

public static void main(String args[])
	{
		Scanner input = new Scanner(System.in);

	int Number, temp;
	int var1, var2, var3, var4,var5;

	System.out.print("Enter a Five Digit Number: ");
	Number = input.nextInt();

	var1 = Number/10000;
	temp = Number% 10000;

	var2 = temp/1000;
	temp = Number%1000;

	var3 = temp/100;
	temp = Number% 100;

	var4 = temp/10;
	temp = Number%10;

	var5 = temp;


	System.out.println(var1);
	System.out.println(var2);
	System.out.println(var3);
	System.out.println(var4);
	System.out.println(var5);


	}

}//end of class SeperateNumbers

You need to use + when concatenating parts of a String.

System.out.println("\n" + var1+"\n" + var2);

You had a , instead of a +

Edited 5 Years Ago by Akill10: n/a

I'm not sure why I was using a comma.... lol even in my C++ "<<" always went before in after a stated variable. Thanks for your quick response.

from
System.out.println("\n" + var1,"\n" + var2);
to
System.out.println("\n" + var1 + "\n" + var2);

thanks for your response, but akill10 already informed me of that solution.

This question has already been answered. Start a new discussion instead.