Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.ByteArrayInputStream;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        String str = "java2s.com";
        ByteArrayInputStream bais = new ByteArrayInputStream(str.getBytes());
        System.setIn(bais);

        Scanner scanner = new Scanner(System.in);
        String input = scanner.next();
        System.out.println(input);
    }
}