Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

shiva kumar


{ City } hyderabad
< Country > india
* Profession *
User No # 21783
Total Questions Posted # 0
Total Answers Posted # 2

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 20
Users Marked my Answers as Wrong # 10
Questions / { shiva kumar }
Questions Answers Category Views Company eMail




Answers / { shiva kumar }

Question { 32726 }

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

/***************************************************/

import java.io.*;

class StringToInt
{
public static void main(String a[]) throws
IOException
{
String s;
BufferedReader br = new BufferedReader(new
InputStreamReader(System.in));
do{
s=br.readLine();
System.out.println("U R Sting
is: "+s);
}while(s.equals(" "));
try
{
double d = new Double(s);
int j = (int)d;
System.out.println(j);
}catch(NumberFormatException e)
{
System.out.println(" Your String is
Not a Number:.. ");
}
}
}

Is This Answer Correct ?    8 Yes 4 No

Question { HCL, 15224 }

how to store and retrive a set of values without using an
array


Answer

I think U need this .......

/*****************************************************/
import java.util.*;

class TreeSetDemo {
public static void main(String args[]) {
// Create a tree set.
TreeSet ts = new TreeSet();

// Add elements to the tree set.
ts.add("C");
ts.add("A");
ts.add("B");
ts.add("E");
ts.add("F");
ts.add("D");

System.out.println(ts);
}
}

/******************************************************/
The output from this program is shown here:
[A, B, C, D, E, F]
/*******************************************************/

/********************************
************ AND ************
**********************************/



import java.util.*;

class HashSetDemo {
public static void main(String args[]) {
// Create a hash set.
HashSet hs = new HashSet();

// Add elements to the hash set.
hs.add("B");
hs.add("A");
hs.add("D");
hs.add("E");
hs.add("C");
hs.add("F");

System.out.println(hs);
}
}

/**************************************/
The following is the output from this program:
[D, A, F, C, B, E]
/****************************************/

Is This Answer Correct ?    12 Yes 6 No