Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java read string input

import java.util.Scanner;
 
public class YourClass {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String inputString = scanner.nextLine();
        System.out.println("Your string: " + inputString);
    }
}
Comment

java input - how to read a string

import java.util.Scanner;  // Import the Scanner class

class Main {
  public static void main(String[] args) {
    Scanner myObj = new Scanner(System.in);  // Create a Scanner object
    System.out.println("Enter username");

    String userName = myObj.nextLine();  // Read user input
    System.out.println("Username is: " + userName);  // Output user input
  }
}
Comment

PREVIOUS NEXT
Code Example
Java :: keytool error: java.io.IOException: keystore password was incorrect java.io.IOException: keystore password was incorrect flutter 
Java :: append button jframe 
Java :: java loop backwards through array 
Java :: how to solve simultaneous equations in mathematica 
Java :: minecraft java arguments 
Java :: java switch 
Java :: how to change orientation of screen in android in fragmetn programmatically 
Java :: adding 2 variable in java 
Java :: java loop object 
Java :: java read file bufferedreader 
Java :: converter int array para string java 
Java :: get device id programmatically android 
Java :: How to create an adjacency list representation of a graph, in Java? 
Java :: how to get only current date in java android studio 
Java :: find object with same attribute java stream 
Java :: how to initialize an array in java 
Java :: How to determine if a given binary tree is a binary search tree, in Java? 
Java :: difference between java and javax 
Java :: switch activity android studi 
Java :: how to create immutable list java 
Java :: worldedit set random blocks 
Java :: create method setsupportactionbar 
Java :: minecraft chunk size 
Java :: java how to find the largest number in an arraylist 
Java :: check if all values are same in list java 
Java :: java obtain list string from list object 
Java :: area of circle in java 
Java :: sorting an arraylist 
Java :: boolean print condition java 
Java :: RecyclerView: No layout manager attached; skipping layout 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =