Skip to main content

Posts

Base of Java

Recent posts

Double to string conversion in Java

Double to String conversion Two ways to convert double to String: 1: Using valueOf() method public static String valueOf(double d) We can convert the double primitive to String by calling valueOf() method of String class. This method returns the string representation of the double argument. double var = 22.22 ; String strg = String . valueOf ( var ); 2: Using toString() method public String toString( ) : This is the another method that can be used to convert double to String. This method returns a string representation of the Double object. The primitive double value represented by this object is converted to a string. double var = 33.33 ; String str = Double . toString ( var ); Example: public class DoubleToString {    public static void main ( String [] args ) {                 // Method 1: using valueOf() method of String class               double dvar = 2 01.11 ;        String strg = String . valueOf ( dvar );        System

JAVA BASICS (OOPs Concepts)

OOPs Basics Java is known as an Object Oriented language. So,  what does Object Oriented mean ? It means that the  foundations  of any kind of  program constructed in Java  might be imagined in terms of  Objects . Note  : Above are the links of separate detailed tutorials on each topic. However if you want to brush up the things for interview, below is a brief of each of the above topic which will help you re-call the things. a) Data b) Instructions for processing that data into a self-sufficient ‘object’ that can be used within a program or in other programs. Advantage of Object Oriented Programming a) Objects are modeled on real world entities. b) This enables modeling complex systems of real world into manageable software solutions. Programming techniques a)  Unstructured Programming  (Assembly language programming) b)  Procedural Programming  (Assembly language, C programming) c)  Object Oriented Programming  (C++, Java, C#, Objective C) Unstructur