input a number and convert it into binary, octal and hexadecimal using built in methods of integer class
sulthana
0
Newbie Poster
Recommended Answers
Jump to PostScanner br = new Scanner(System.in);
int num = br.nextInt();
Integer a = Integer.valueOf(num);
System.out.println(a.toBinaryString(num));
System.out.println(a.toOctalString(num));
System.out.println(a.toHexString(num));The toBinaryString and the other methods are static, so you don't need to create a new Integer object. What's the point of using the object created …
All 4 Replies
gunjannigam
28
Junior Poster
javaAddict
900
Nearly a Senior Poster
Team Colleague
Featured Poster
gunjannigam
28
Junior Poster
javaAddict
900
Nearly a Senior Poster
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.