Jump to content

Why Wont This Run!? Please Help


slashjack

Recommended Posts

Hi everyone, ive writtern this code and it doesnt work properly, can someone please help me to understand why this doesnt work. Or one better, solve the mystery! Thanks in advance! :)

import java.util.Scanner;/* This program is from lecture 3, it asks the user for their name, then says hello name* if that name = lucy then i want it to say something else.* 19/10/11* @author ahr */public class lecture { public static void main (String[] args) throws Exception {  String  name;  System.out.println("Enter your name");  Scanner Scan = new Scanner(System.in);  name = Scan.next();  if (name = "lucy")   System.out.print("Hi Rucy Roo");  else   System.out.print("hello " + name); }}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...