Computer Science, asked by purveshKolhe, 2 months ago

What is the output
public static Brainly {
public static void main )Strings [] args) {
int m = 4;
int lol = 10;
S.o.pln(m.replace(4,10) + lol);
}
}

Answers

Answered by BrainlyProgrammer
9

Corrected Co‎de(after removing syntax errors):-

  1. public class Brainly {
  2. public static void main (Strings [] args) {
  3. int m = 4;
  4. int lol = 10;
  5. System.out.println(m.replace(4,10) + lol);
  6. }
  7. }

  • Your co‎de has some errors due to which it will not compile

What are the errors?

  • Line no. 5, m.replace(4,10)
  • m is integer and replace() is a string function
  • replace() is used to replace a character/set of character with another character/set of character in a string.

Here is your Similar Co‎de

public class Brainly {

public static void main (Strings [] args) {

String m = "4";

int lol = 10;

System.out.println(m.replace("4","10") + lol);

}

}

Note:- In this case, your output will be 1010 not 20

because, string gets concatenated .

Similar questions