diff --git a/src/HelloUser.java b/src/HelloUser.java new file mode 100644 index 0000000..dea870a --- /dev/null +++ b/src/HelloUser.java @@ -0,0 +1,19 @@ + +public class HelloUser { + + + private String name; + + public HelloUser(String pname) + { + name=pname; + } + + + public void greetUser() + { + + System.out.println("Hello "+name); + } + +} diff --git a/src/HelloWorld.java b/src/HelloWorld.java index ea3c57c..0efe5c8 100644 --- a/src/HelloWorld.java +++ b/src/HelloWorld.java @@ -1,9 +1,16 @@ - +import java.util.Scanner; public class HelloWorld { public static void main(String[] args) { + + Scanner in = new Scanner(System.in); // TODO Auto-generated method stub - System.out.println("Hello ASE2017 - How are you? :)"); + System.out.println("Hello ASE2017 - How are you now? :)"); + System.out.println("Please enter your name "); + String name=in.nextLine(); + HelloUser user= new HelloUser(name); + user.greetUser(); + } - } +