Multiple choice

Bill Gates wants your help in correcting the following error. Suggest the correct solution: Statement -System. out. Print ln (s. sub Str (1,2)); Error - cannot resolve symbol method sub Str (int, int)

  1. Use sub string

  2. Use one argument

  3. Use sub str

  4. Use two arguments

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The error occurs because Java is case-sensitive and String methods have specific names. The correct method name is 'substring()' not 'subStr()'. The space in 'sub Str' also causes compilation error. Java String objects use camelCase naming convention for methods like substring(), indexOf(), charAt().