package input;
import java.util.Scanner;
public class Input {
/**
* Created by Björn Johansson 2012
*/
public static void main(String[] args)
{
Scanner user_input = new Scanner(System.in);
String first_name;
System.out.print("Vad heter du i förnamn? ");
first_name = user_input.next();
if (first_name = "Ola")
{
System.out.print("Hej Ola!");
}
else if (first_name = "Eva")
{
System.out.print("Hej Eva!");
}
else
{
System.out.print("Du har angett ett ogiltigt namn!");
}
}
}
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Type mismatch: cannot convert from String to boolean
Type mismatch: cannot convert from String to boolean
at input.Input.main(Input.java:20)