Ask Mitra Latest Questions
Switch (x) { case 1: m=15; n=20; case 2: p=25; break; y=m+n-p; }
How do I get to the next page? JButton works fine tho. apt = new JMenu(” User Profile “); apt.setBounds(700,0,200,40); apt.setFont(new Font(“Arial”, Font.BOLD,20)); apt.setForeground(new Color(255, 197, 189)); //apt.addActionListener(this); menub.add(apt); apt.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { UserProfile userprofile = new ...Read more
For the above question i tried below programs, but when i run it takes output more than numbers entered by user in terminal and doesn’t stop neither shows the desired output. import java.util.Scanner; public class UserOriented { publicstaticvoidmain(String[] args) { Scannersc=newScanner(System.in); try { System.out.println(“Enter the total ...Read more
When i provide number as an argument then it works for BigInteger but when i try to convert that to take user Input then it don’t work. See the below example where i am using arguments 100 but i tried ...Read more
I am using this java code to print the factorial of any number. // Write a function to find the factorial of n numbers import java.util.Scanner; public class Factorial { publicstaticvoidmain(String[] args) { Scannersc=newScanner(System.in); try { System.out.println(“Enter any number to find it’s factorial”); Longnumber=sc.nextLong(); if (number==0) { System.out.println(“The factorial of ...Read more