This method has followings variants which depends on the passed parameters. This method returns the string representation of the passed argument.
Syntax:
Here is the syntax of this method:
static String valueOf(boolean b) or static String valueOf(char c) or static String valueOf(char[] data) or static String valueOf(char[] data, int offset, int count) or static String valueOf(double d) or static String valueOf(float f) or static String valueOf(int i) or static String valueOf(long l) or static String valueOf(Object obj)
Parameters:
Here is the detail of parameters:
Return Value :
Example:
import java.io.*;
public class Test{
public static void main(String args[]){
double d = 102939939.939;
boolean b = true;
long l = 1232874;
char[] arr = {'a', 'b', 'c', 'd', 'e', 'f','g' };
System.out.println("Return Value : " + String.valueOf(d) );
System.out.println("Return Value : " + String.valueOf(b) );
System.out.println("Return Value : " + String.valueOf(l) );
System.out.println("Return Value : " + String.valueOf(arr) );
}
}
This produces following result:
Strategy Design Patterns We can easily create a strategy design pattern using lambda. To implement…
Decorator Pattern A decorator pattern allows a user to add new functionality to an existing…
Delegating pattern In software engineering, the delegation pattern is an object-oriented design pattern that allows…
Technology has emerged a lot in the last decade, and now we have artificial intelligence;…
Managing a database is becoming increasingly complex now due to the vast amount of data…
Overview In this article, we will explore Spring Scheduler how we could use it by…