aliensbrain
  • Home
  • Study
  • Quizzes
  • 🎤AI Practicefree
  • Notebooks
  • Community
  • Sign in
  • Java Programming Fundamentals
  • `String name="ALIEN"; name.reverse();` Is code successful...
Multiple choice java

String name="ALIEN"; name.reverse();
Is code successfully compiled..???

  1. True

  2. False

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

String objects in Java are immutable and do not have a reverse() method. To reverse a string, you would need to use StringBuilder or convert to a char array, reverse it, and create a new string.

Keep practicing — related questions

  • Read this piece of code carefully if("String".toString() == "String") System.out.println("Equal"); else Sys...
  • After the following code fragment, what is the value in fname? String str; int fname; str = "Foolish boy.";...
  • After the following code fragment, what is the value in fname?String str;int fname;str = ";Foolish boy.";fn...
  • 19 Read this piece of code carefully if("String".toString() == "String") System.out.println("Equal"); else ...
  • What is the result os this String s1="hi"; String s2="hi"; (s1==s2)-->returns
  • class Demo {public static void main(String[] args) {StringBufferch=new StringBuffer(DAD); StringBufferst=ne...
  • Which code will not compile?
  • What will be the result of executing the following code? 1. boolean a = true; 2. boolean b = false; 3. bool...
Play the full quiz 🎤 Practise this topic out loud

Practice this topic

  • Programming Languages and Compilers (2284 questions)
Advertisement
© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy