Hello Everyone ! we will be learning most frequent interview asked question with its explanation. And we will be talking about the way we think before solving or giving answer to interviewer .So keep enjoying . Happy java learning..!!
IF YOU NEED EXPLANATION TO ANY QUESTION JUST COMMENTS FOR REQUEST WITH QUESTION NO.
1. What is typecasting?
2. Write a program to show an implicit typecasting?
3. Write a program to show an explicit typecasting?
4. Why we need explicit typecasting?
5. What is the output of below code?
public class callkr {
public static void main(String[] args) {
float f=10;
System.out.println(f);
}
}
6.What is the output of below code?
public class callkr {
public static void main(String[] args) {
float f=10.0;
System.out.println(f);
}
}
7.What is the output of below code?
public class callkr {
public static void main(String[] args) {
float f=100/4.0;
System.out.println(f);
}
}
8.What is the output of below code?
public class callkr {
public static void main(String[] args) {
float f=100/4.0f;
System.out.println(f);
}
}
9.This code has an error. What should we do to solve this error?
public class callkr {
public static void main(String[] args) {
float f=10/4.0f+10+20f+10d;
System.out.println(f);
}
}
10. What is type promotion and type demotion in java?
No comments:
Post a Comment