473,473 Members | 1,419 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How the following java statement works?

itiger
12 New Member
Expand|Select|Wrap|Line Numbers
  1. System.out.println(3.2 + " 4.5");
  2.  
The value 3.2 is of what type (double or String). If it is 'double' then is it possible to typecast 'double to String'. If it String then please explain why it is String.
Jan 9 '11 #1
3 1100
horace1
1,510 Recognized Expert Top Contributor
the 3.2 is a double and the " 4.5" is a String
the 3.2 is converted to a String and concatenated (the + operator) with the " 4.5" so when run prints
Expand|Select|Wrap|Line Numbers
  1. 3.2 4.5
  2.  
Jan 9 '11 #2
itiger
12 New Member
Is it true that all the things written inside the "System.out.print()" is automatically gets converted into the String type.
Jan 10 '11 #3
nathj
938 Recognized Expert Contributor
Where possible Java will use the toString() method on the object in such cases. As Object has a toString() method on it this will be called if no custom version has been provided.
Jan 10 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Larry R Harrison Jr | last post by:
I designed this webpage: http://www.dbases.net/photography_pages/new_style_frames_index.html It has horizontal hover/pop-down menus; it works fine on the given machine run off the hard drive,...
1
by: mike | last post by:
regards: My program logic is following: http://www.wretch.cc/album/show.php?i=otp&b=1&f=1114017894&p=4 from Step1 to Step4 Any positive suggestion is welcome. thank you May goodness be...
1
by: BerkshireGuy | last post by:
The following statement works in Access 2000, but when I run the same database in Access 2003, I get a #Num! error. =IIf(IsError(!!!),0,!!!)/IIf(IsError(!!!),1,!!!) Any ideas? Thanks, ...
6
by: David | last post by:
I am using ADO to run some SQL statements in Access. First, I run query to create a table using SELECT . . . INTO Table A. Then, I run a query to SELECT . . . FROM Table A to get some data and...
8
by: aditya | last post by:
hi, Can anybody please tell me that how the following printf(...) statement works- main(){ int d=9; printf("%d",printf("%d")); return 0;
2
by: vasilip | last post by:
I am trying to use the XMLUPDATE stored procedure. Installed fine, and seems to work great if I execute the statement from a sql query using the controll center.. Doesn't work from java however. I...
9
by: maas | last post by:
Hello I have a problem when coding the statement stmt.execute("insert into Member values ("+mname+" ,"+mail+","+tel+")"); where mname, mail,tel are variables which the user inputs them and...
1
by: dhutton | last post by:
My CASE Statement works fine like this: ========================================================= CASE WHEN so.PhoneNum LIKE '999%' THEN 'Chester' END AS Company, (Works!)...
3
by: Joshepmichel | last post by:
Please to help me to following problem I want to do this 1. create Table Name MEMBER on the Database Name "mytestdb", 2. Add the Values to the Table through the Key board Inputs during running...
6
by: =?Utf-8?B?Q2hhcmxlcw==?= | last post by:
Please help me convert the following Java to C# class ProgramChoice { private Class cls; private String text; ProgramChoice(String text, Class cls) { this.cls = cls; this.text = text; }
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.