Sublime Forum

After Scanner class output never triggers?

#1

import java.util.Scanner;
public class Insertion {
public static void main(String[] args){

	Scanner sc = new Scanner(System.in);
	int arr[] = new int[5];

	System.out.println("enter array elements");
	for(int i=0;i<arr.length+1;i++){
		arr[i] = sc.nextInt();
	}

	for(int i:arr){
		System.out.println(i);
	}
}	

}

recently installed sublime text 3 and ran above code(taking input from user --> store in array --> display it).
But in console output never triggers input operation happening endlessly.

0 Likes

#2

SublimeText console is output only: cf Build broken? - Python 3 - input()
You need to use plugins like Terminus: https://www.youtube.com/watch?v=etIJMVIvVgg

1 Like

#3

{
“target”:“terminus_exec”,
“cancel”:“terminus_cancel_build”,
“auto_close”:false,
“focus”:true,
“timeit”:false,
“shell_cmd”: “javac $file && java $file_base_name”,
“cwd”:"${file_path:’${folder}’}"
}

above is my build but an error occurs saying
“bash: -c: line 0: unexpected EOF while looking for matching `’’
bash: -c: line 1: syntax error: unexpected end of file”

0 Likes