Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

string is immutable than can we change the data  RSS feed

 
gauraw gupta
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please help me what the answer of this question.



What is output.

Thanks
Gauraw
 
Greg Brannon
Bartender
Posts: 563
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't you code it and see?
 
gauraw gupta
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please provide me the answer?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What prevents you from following Greg's advice?
 
gauraw gupta
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have no java right now in my laptop. If i do this why i ask the question. if you have no answer please don't suggest me i need the answer only.

Thanks
 
Henry Wong
author
Sheriff
Posts: 23283
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe it would be a good idea to get Java installed -- or wait until you have access. Quite frankly, it will be very difficult to learn Java without actually trying it out (sort of like learning how to drive without actually getting into a car).

Henry
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And please use code-tags when posting code. This time I'll add them for you since you're relatively new.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16026
87
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code you posted will not compile because you are re-defining a variable in line 3 that was already defined in line 2.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12541
48
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Jesper has already said, this code won't compile. If you fix that error and get it to compile, the answer should be obvious.

Remember, there is a difference between changing the object and changing what object a reference points to...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!