ALLInterview.com :: Home Page Forum9.Com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage   interview questions urls   External Links  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories >> Code-Snippets >> Programming-Code >> Java-Code >> J2EE-Code
 
 


 

 
Question
How to convert string containing decimal point into integer
in java? For example given a string like "3.14" as input how
to get integer 3 as result.
 Question Submitted By :: Pradeep
I also faced this Question!!     Rank Answer Posted By  
 
  Re: How to convert string containing decimal point into integer in java? For example given a string like "3.14" as input how to get integer 3 as result.
Answer
# 1
/* How to convert string containing decimal point into integer
in java? For example given a string like "3.14" as input how
to get integer 3 as result. */

String myStr = "3.14";
Int myInt = Float.valueOf(myStr).intvalue();
 
Is This Answer Correct ?    1 Yes 0 No
Pradeep
 
  Re: How to convert string containing decimal point into integer in java? For example given a string like "3.14" as input how to get integer 3 as result.
Answer
# 2
class StringToInt {
	public static void main (String[] args) {
    String s="3.14";
    double i=Double.parseDouble(s);
    int i1=(int)i;
    System.out.println (i1);
 
    }
}
 
Is This Answer Correct ?    1 Yes 0 No
Indresh_ips
[Yen Exall Soft Pvt.ltd]
 
 
 
  Re: How to convert string containing decimal point into integer in java? For example given a string like "3.14" as input how to get integer 3 as result.
Answer
# 3
I don't know
 
Is This Answer Correct ?    0 Yes 0 No
Subramanyam
 
 
 
 
Other J2EE Code Interview Questions
 
  Question Asked @ Answers
 
How to convert string containing decimal point into integer in java? For example given a string like "3.14" as input how to get integer 3 as result.  3
how to display date after one month using from today date in jsp TCS1
How to read MS-word document in java without displaying junk (unnecessary) data? Cognizent1
 
For more J2EE Code Interview Questions Click Here 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com