Can we use some other var than "myVar". | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Can we use some other var than "myVar".

import java.util.Scanner; class MyClass { public static void main(String[ ] args) { Scanner myVar = new Scanner(System.in); System.out.println("Hi " + myVar.nextLine() + "! This is my first Java program!!!"); } }

7th Apr 2017, 7:43 AM
Hardik Kumar
Hardik Kumar - avatar
2 Answers
+ 10
Yes. Provided you replace myVar at all points in the program with a permissible Identifier that you want
7th Apr 2017, 7:47 AM
Pixie
Pixie - avatar
+ 1
well yes
9th Apr 2017, 6:24 AM
Arsh Verma
Arsh Verma - avatar