Java -String
String name;
Scanner input = new Scanner(System.in);
System.out.println("Please enter your name");
name = input.nextLine();
Ares Azlan
String name;
Scanner input = new Scanner(System.in);
System.out.println("Please enter your name");
name = input.nextLine();
class Main {
public static void main(String[] args) {
// create a string using new
String name = new String("Java String");
System.out.println(name); // print Java String
}
}
class Main {
public static void main(String[] args) {
// create strings
String first = "Java";
String second = "Python";
String third = "JavaScript";
// print strings
System.out.println(first); // print Java
System.out.println(second); // print Python
System.out.println(third); // print JavaScript
}
}
// create a string using the new keyword
String name = new String("Java String");