Wanted to declare a local variable inside a static method. main().
Here is what my code looks like -
Code:
Is it something I am doing right?
Any Sugession would be helpful
Here is what my code looks like -
Code:
class Operator
{
static int a;
public static void input() {
Scanner in=new Scanner(System.in);
System.out.println("Enter the number:");
a=in.nextInt(); //this is nextInt and NOT Nextint
}
public static void output() {
System.out.println("Number is:" + a);
}
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
input();
output();
}
}
Is it something I am doing right?
Any Sugession would be helpful