typecasting Flashcards

1
Q

from String to int

A

int num= Integer.parseInt(str);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

from string to double

A

double num= Double.parseDouble(str);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

from double to int

A

int intNum= (int) dblNum;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

from int to double

A

double dblNum= intNum;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

from int to char

A

char ch=(char) intNum;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

from double to String

A

String str= “ “ + dblNum;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

from char to String

A

String str= “ “ + ch;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

String to char

A

char ch=str.charAt(position);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly