Beginner Java Progrmming help..!
Go to solution
Solved by rockking1379,
here you go
package tests;import java.util.*;public class koka { public static void main (String args[]) { Scanner CZ= new Scanner (System.in); System.out.println("Name Car 1"); String First = CZ.nextLine(); System.out.println("Horsepower"); int Car1 = CZ.nextInt(); CZ.nextLine(); System.out.println("Name Car 2"); String Second = CZ.nextLine(); System.out.println("Horsepower"); int Car2 = CZ.nextInt(); if (Car1>Car2) { System.out.println(First +" Is powerful"); } else { System.out.println(Second +" Is powerful"); } CZ.close(); }}
change class name to suit your needs,
here is an article i used to understand what was happening.
http://stackoverflow.com/questions/8873351/reading-strings-next-and-nextline-java
look specifically at answer 1
also, use the code button

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now