//Octal to Hexadecimal in JAVA
import java.util.Scanner;
class Octal_Hexa
{
Scanner scan;
int num;
void getVal()
{
System.out.println("Octal to HexaDecimal");
scan = new Scanner(System.in);
System.out.println("\nEnter the number :");
num = Integer.parseInt(scan.nextLine(), 8);
}
void convert()
{
String hexa = Integer.toHexString(num);
System.out.println("HexaDecimal Value is : " + hexa);
}
}
public class O_H
{
public static void main(String args[])
{
Octal_Hexa obj = new Octal_Hexa();
obj.getVal();
obj.convert();
}
}
import java.util.Scanner;
class Octal_Hexa
{
Scanner scan;
int num;
void getVal()
{
System.out.println("Octal to HexaDecimal");
scan = new Scanner(System.in);
System.out.println("\nEnter the number :");
num = Integer.parseInt(scan.nextLine(), 8);
}
void convert()
{
String hexa = Integer.toHexString(num);
System.out.println("HexaDecimal Value is : " + hexa);
}
}
public class O_H
{
public static void main(String args[])
{
Octal_Hexa obj = new Octal_Hexa();
obj.getVal();
obj.convert();
}
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.