0

Can anyone give the code for a password maker in Java

Like the user can enter the total no. Of charecters that he wants in the code and the code will give the relevant password The password must be random and must contain integers and charecters

10th Apr 2020, 7:00 PM
Coder
Coder - avatar
4 Réponses
+ 1
Coder my opinion is first start and complete the java course here, then try coding.. Otherwise you get confuse.. The main method in java must be like public static void main(String args[]) { ... } Edit: instead of k=c+d, white this: k=k+c+d; If not necessary start with zero, put k=""; inplace of k="0". Note that s=(char)a ; causes some invisible chars also
10th Apr 2020, 9:52 PM
Jayakrishna 🇮🇳
0
I'm sorry but we don't give out codes. If you are having trouble with creating the password maker, please post a link to the code. Happy coding :)
10th Apr 2020, 7:11 PM
CeePlusPlus
CeePlusPlus - avatar
0
import java.util.*; class sample { void main() { int i,j,p,g; double b,a; String k,c,d; char s; Scanner ob= new Scanner(System.in); System.out.println("Enter no. of charecters in ur password "); i=ob.nextInt(); j=0; k="0"; while(j<=i) { a= Math.random()*97; p=(int)Math.round(a); s=(char)a; b= Math.random()*9; g= (int)Math.round(b); c=Integer.toString(g); d=String.valueOf(s); k=c+d; j++; } System.out.println(k); } }
10th Apr 2020, 7:13 PM
Coder
Coder - avatar
0
Here is the code but it is not giving any output
10th Apr 2020, 7:14 PM
Coder
Coder - avatar