Java Program to Convert Number From Decimal to Binary

Java program to convert number from Decimal to Binary public class DecimalToBinaryExample1{ public static void main(String args[]){ System.out.println(Integer.toBinaryString(10)); System.out.println(Integer.toBinaryString(21)); System.out.println(Integer.toBinaryString(31)); }} public class DecimalToBinaryExample2{ public static void toBinary(int decimal){ int…

0 Comments

Java Program to Convert Number From Decimal to Octal

Java program to convert number from Decimal to Octal public class DecimalToOctalExample1{ public static void main(String args[]){ System.out.println(Integer.toOctalString(8)); System.out.println(Integer.toOctalString(19)); System.out.println(Integer.toOctalString(81)); }} public class DecimalToOctalExample2{ public static String toOctal(int decimal){ int…

0 Comments

Java Program to Draw a Rectangle Using Swing

Java program to draw a rectangle using swing import java.awt.Graphics; import javax.swing.JComponent; import javax.swing.JFrame; class MyCanvas extends JComponent { public void paint(Graphics g) { g.drawRect (10, 10, 200, 200); }…

0 Comments

Enable and Disable Button in Java Swing

Enable and Disable button in Java swing // This program will create disable or enable button using Swing. package Swing; import java.awt.BorderLayout; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.AbstractAction;…

0 Comments