public void userInput(String cityName, int cityPopulation, int cityInfrastructureLevel) { Scanner userInput = new Scanner (System.in); System.out.println("Enter a city name:"); cityName = userInput.nextLine(); System.out.println("Your city's name is " + cityName); } public static void main(String[] args) { NewClass myClass = new NewClass(cityName, cityPopulation, cityInfrastructureLevel); myClass.userInput(name, population, infrastructureLevel); System.out.println(myClass.getName()); }
NewClass
cityName
cityPopulation
cityInfrastructureLevel
name
population
infrastructureLevel
Main
userInput
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)