Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Cesar Gonzalez   on Mar 02 In Java Category.

  
Question Answered By: Baylen Smith   on Mar 02

I think you want to read data from the console, i.g. score1 and score2 and then
compare it. Otherwise you have to assign score1 and score2 with your own values,
for example with score1 = 2 and score2 = 3.
Then you can continue with your comparison. If you want to read the data from
the console you have to do the following:

import java.io.*; //Necessary for BufferedReader

public class  Team
{
public static  void main(String[] args)
{
//After declaration of variables
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

//After declaration of the inputstream
println("Enter your score: ");
score1 = readline();
println("Enter second score: ");
score2 = readline();

//Now continue with your comparison
if(score1 > score2)
...
}
}

Share: 

 
 
Didn't find what you were looking for? Find more on I need help with this code Or get search suggestion and latest updates.


Tagged: