About Question enthuware.ocpjp.i.v11.2.1175 or v11.2.3577:
Moderator: admin
- 
				Michalrk1978
 - Posts: 9
 - Joined: Thu May 07, 2020 5:15 pm
 - Contact:
 
About Question enthuware.ocpjp.i.v11.2.1175 or v11.2.3577:
"replace(char oldChar, char newChar) method returns the same String object if both the parameters are same, i.e. if there is no change." - Is the behavior of this method documented in any official Oracle documentation? Could you please provide a source from which to find out such details of how the standard Java API works?
			
			
									
									
						- 
				admin
 - Site Admin
 - Posts: 10443
 - Joined: Fri Sep 10, 2010 9:26 pm
 - Contact:
 
Re: About Question enthuware.ocpjp.i.v11.2.1175 :
You can get such details from JavaDoc API documentation. For example, JavaDoc API documentation for replace method says:
			
			
									
									
						If the character oldChar does not occur in the character sequence represented by this String object, then a reference to this String object is returned.
- 
				Michalrk1978
 - Posts: 9
 - Joined: Thu May 07, 2020 5:15 pm
 - Contact:
 
Re: About Question enthuware.ocpjp.i.v11.2.1175 :
I have read the JavaDoc API documentation for the replace method and in my opinion it does not explain this method's behavior
"String".replace('g','g')=="String" - the character 'g' occur in the character sequence "String", so the quoted piece of documentation doesn't explain the behavior of the method.
			
			
									
									
						"String".replace('g','g')=="String" - the character 'g' occur in the character sequence "String", so the quoted piece of documentation doesn't explain the behavior of the method.
- 
				admin
 - Site Admin
 - Posts: 10443
 - Joined: Fri Sep 10, 2010 9:26 pm
 - Contact:
 
Re: About Question enthuware.ocpjp.i.v11.2.1175 :
Sorry, my mistake. You are right. That statement doesn't explain the behavior. Let me see if I can find a valid reference.
Paul.
			
			
									
									
						Paul.
Who is online
Users browsing this forum: Bing [Bot] and 37 guests