#Topic-7 Previous topic (6) we have discussed about Wrapper class, auto-boxing, UN-boxing and other related topics. If you have not gone through that topic, click this link Wrapper class, auto-boxing, UN-boxing in Java? In this section we will discuss about How to convert String into primitive data types and primitive data types into String. How to convert String into primitive data type: Note: value should be compatible to destination type (we can’t convert “java” into int) //1st way Example of convert String to Integer: String str1 = "5"; int result = Integer.parseInt(str1); // Using Integer.parsrInt() System.out.println(result); Example of convert String to Double: String str=”125”; double a1=Double.parseDouble(str); System.out.println(a1); Example of convert String to Boolean: String a=”true”; boolean a=Boolean.parseBoolean(a); System.out.println(a); Example of convert...
TechGeek or This blog is a widely used robust technology. Let's start learning Java from basic questions like what is Java , Core Java, where it is used, what type of applications are created in Java, why use java and Java platforms etc. Our Java tutorial helps you to learn Java with easy and simple examples. It will help you begin from scratch, just give it a start even without having the knowledge about c or any other programming , you will learn everything gradually during programming.