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
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
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 :)
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);
}
}
0
Here is the code but it is not giving any output