What will happen, when the program contain same name of variable using different capital letter and small letter of an alphabet; these variables have assigned different values.

Answer: The program will run and output will be using values of all variables.

Program:

//  first write a class in the program
class Five
{
    // define main from where the execution of program begins
    public static void main(String args[])
    {
        //define variables data types
        int n=10;
        int N=20;
       
        // call print function
        System.out.println(N+","+n);
    }
}


Sample output:

Post a Comment

Previous Post Next Post