Difference between object oriented object based programming language

What happens when you add double value to String ?

Answer : Result would be String object. Please see example below:

package com.javahonk.operatortest;

public class StringTest {

    public static void main(String[] args) {

	String value = "Java Honk";
	double d = 55.0;

	value = value + d;

	System.out.println(value);

    }

}

 

Output:

What happens when you add double value to String

Leave a Reply

Your email address will not be published. Required fields are marked *