logo

Java String ValueOf() Method


Show

Description

This system has subsequent variants, which rely on the bypassed parameters. This way returns the string depiction of the last row.

  • valueOf(boolean b) − Revisits the string symbol of the boolean argument.
  • valueOf(char c) – Revisits the string image of the char argument.
  • valueOf(char[] data) – Revisits the string depiction of the char array argument.
  • valueOf(char[] data, int offset, int count) – Revisits the string demonstration of a specific subarray of the char array argument.
  • valueOf(double d) – Revisits the string sign of the double argument.
  • valueOf(float f) – Revisits the string account of the float argument.
  • valueOf(int i) – Revisits the string version of the int argument.
  • valueOf(long l) – Revisits the string depiction of the long argument.
  • valueOf(Object obj) – Revisits the string illustration of the Object 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:

  • See the description.

Return Value

  • This method returns the string representation.

Example

import java.io.*;
public class Test {

   public static void main(String args[]) {
      String Str = new String("   Welcome to Intellinuts.com   ");

      System.out.print("Return Value :" );
      System.out.println(Str.trim() );
   }
}

This will produce the following result:

Output

Return Value : 1.02939939939E8
Return Value : true
Return Value : 1232874
Return Value : abcdefg

Here at Intellinuts, we have created a complete Java tutorial for Beginners to get started in Java.