- 1

How to declare a variable without entering the value during the coding? About Java.

I want to enter value at the output window

16th Aug 2019, 11:05 AM
Daksh Yadav
Daksh Yadav - avatar
3 odpowiedzi
+ 3
Are talking about html, Javascript, c#, python, c++, java or India language?
16th Aug 2019, 11:11 AM
Calviղ
Calviղ - avatar
+ 1
As far as I know, there is no way to declare a variable without assigning a value at the same time in Hindi or English, which are the two most used languages in India.
16th Aug 2019, 7:56 PM
Gloria Borger
Gloria Borger - avatar
- 1
If you are talking about declaring a variable but use user input to assign it a value you can use a Scanner to ask for user to input a value Example: import java.util.Scanner; class Example { public static void main (String[] args) { Scanner scan = new Scanner (System.in); System.out.println("Please enter a value: "); int userInput = scan.nextInt(); scan.close (); } }
21st Aug 2019, 1:40 PM
Christine