Saved Bookmarks
| 1. |
Write a java program to convert octal to binary???? |
|
Answer» CLASS Octal_Binary { Scanner scan; int num; void getVal() { System.out.println("Octal to Binary"); scan = NEW Scanner(System.in); System.out.println("\nEnter the number :"); num = Integer.parseInt(scan.nextLine(), 8); } void convert() { STRING binary = Integer.toBinaryString(num); System.out.println("Binary VALUE is : " + binary); } } class MainClass { PUBLIC static void main(String args[]) { Octal_Binary obj = new Octal_Binary(); obj.getVal(); obj.convert(); } } |
|