Java Programming
primer-original-v2mediumJava Programming05 Regular Expressionprimer-original-v2

Predict the output of the below code : String emailId="john#global.com"; System.out.println(emailId.indexOf('@'));

Answer options

A
indexOf('@'));
B
Any negative integer
C
-1
D
0
E
1

Correct answer: -1

Explanation

Quick AnswerThe correct answer is -1 because it directly addresses the core logic of Java Programming.

This question has been retained as-is due to its unique context.

Related Java Programming questions

Practice more Java Programming questions

PrimerPrep has independently reviewed practice questions and coding exercises — all free.