Write a program that takes a 5 digit number and calculates
2 power
that number and prints it.
Answer / r.dhanunjay
import java .io.*;
public class Digits {
public static void main(String[] args) throws IOException
{
try
{
System.out.println("Enter the number with 5 didgits");
BufferedReader br= new BufferedReader(new
InputStreamReader( System.in));
String str = br.readLine();
int i =Integer.parseInt(str);
int j =String.valueOf(i).length();
if(j==5)
{
double k =Math.pow(i,2);
System.out.println(k);
}
else
{
System.out.println("enter only 5 didgits number");
}
}
catch(IOException e)
{
System.err.println();
}
}
}
Is This Answer Correct ? | 7 Yes | 0 No |
33. try { 34. // some code here 35. } catch (NullPointerException e1) { 36. System.out.print(”a”); 37. } catch (RuntimeException e2) { 38. System.out.print(”b”); 39. } finally { 40. System.out.print(”c”); 41. } What is the result if a NullPointerException occurs on line 34? 1 c 2 a 3 ab 4 ac
What is nested interface?
What is the full name of java?
What is meant by event handling?
Is alive and join method in java?
What is compareto?
How do you create a first line indent?
How to pass arraylist to stored procedure in java?
Does substring start with 0?
What is the purpose of using java.lang.class class?
Why collection is called framework in java?
What is a subsequence of a string?