Java Java Basics Getting Started with Java Strings, Variables, and Formatting

kamalesh flamboyant
kamalesh flamboyant
297 Points

Define a string variable named firstName that stores your name. Set the value to your name.

import java.io.Console; public class my name { public static void main(String[] args){ Console console=System.console(); String firstname ="kamal";

    console.printf("hello my name is %s\n",firstname);
  console.printf("%s is dancing\n",firstname);

} }

Name.java
// I have setup a java.io.Console object for you named console
import java.io.Console;
public class my name {
   public static void main(String[] args){
     Console console=System.console();
     String firstname ="kamal";

        console.printf("hello my name is %s\n",firstname);
      console.printf("%s is dancing\n",firstname);
  }
}