• Post Reply Bookmark Topic Watch Topic
  • New Topic

What did I do wrong in my code?  RSS feed

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm new to JAVA Programming and I need help. I'm using Eclipse as my IDE and I wrote a program:

package org.babynamecomparison.java;

import java.util.Scanner;

public class BabyNameComparison {
public static void manin(String[] args){
Scanner userInputScanner = new Scanner(System.in);
System.out.print("Enter 1st FirstName");
String name1 = userInputScanner.nextLine();
System.out.print("Enter 2nd First Name");
String name2 = userInputScanner.nextLine();
System.out.print("Enter 3rd First Name");
String name3 = userInputScanner.nextLine();

System.out.println(name1 + "" + name2);
System.out.println(name1 + "" + name3);
System.out.println(name2 + "" + name1);
System.out.println(name2 + "" + name3);
System.out.println(name2 + "" + name1);
System.out.println(name3 + "" + name2);
}
}

When I try to run it, it says "The selection cannot be launched, and there are no recent launches."
I do get a warning that says, "Resource leak: 'userInputScanner' is never closed". What am I doing wrong?
 
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
personally, I'd say your problem is that you are using Eclipse.

Almost everyone here will tell you that if you are a beginner, you should use a simple editor, and learn to compile from the command line.

However, that can be debated forever.

But your problem is pretty simple...You do not have a method anywhere named:



You probably think you do, but look VERY closely at what you have.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!