Q:

There is an error while using System.out.println when both text and variables

I am a beginner in Java so I wrote a program to understand the OOP concepts but it gives me an error when trying to use System.out.println().
Here's the code
public static void main(String[] args) {
    sampleClass ADD = new sampleClass();
    Scanner input = new Scanner(System.in);
    int fNum;
    int sNum;
    System.out.println("Enter the first number to Add");
    fNum = input.nextInt();
    System.out.println("Now enter the second number");
    sNum = input.nextInt();
    int sum;
    sum = ADD.add(fNum, sNum);
    System.out.println("The sum of " fNum " and " sNum " is " sum);
}

A:

Replace this line System.out.println("The sum of " fNum " and " sNum " is " sum); with
System.out.println("The sum of " +fNum+ " and " +sNum+ " is " +sum);

Please Note: In Java, the operator "+" normally acts as an arithmetic operator unless one of its operands is a String. If necessary it converts the other operand to a String before joining the second operand to the end of the first operand.
Examples:
If one of the operands is not a String it will be converted:
int age = 12; 
 System.out.println("My age is " + age); 

