import java.util.Scanner; // needed to get user input
public class MPGHExample {
public static void main(String args[]) {
Scanner input = new Scanner(System.in); // instantiate Scanner
String userPassword;
int passwordLength;
// Prompt user
System.out.println("Enter a password. Can containt a-z, A-Z, 0-9");
userPassword = input.nextLine(); // store password
passwordLength = userPassword.length();
// Check to see if password is atleast 8 digits long
if(passwordLength >= 8){
// checks to see if password contains only these characters
if(userPassword.matches("[a-zA-Z0-9]+")){
System.out.println("That is a valid password.");
} else {
System.out.println("You entered illegal characters.");
}
} else {
System.out.println("Password must be 8 characters long.");
}
}
}

public static void main(String[] args)
{
//variables
boolean length=false;
boolean up=false;//Upper letter
boolean dwn=false;//Lower letter
boolean num=false;//number
char ch;
//enter Scanner
Scanner r = new Scanner(System.in);
//enter prompt;
System.out.println("Please enter a password with atleast 8 character\nthat consist of one upper case, one lower case and one digit.");
String password=r.next();//body of for loop
//enter the restrictions
for(int i=0;i<password.length();i++)
{
//string
ch=password.charAt(i);
if(password.length()>7)
{
length=true;
if (Character.isUpperCase(ch))
{
up=true;
}
else if(Character.isLowerCase(ch))
{
dwn=true;
}
else
{
num=true;
}
}
}
if(length&&up&&dwn&&num)
{
System.out.printf("You successfully entered your password!");
}
else
{
System.out.printf("The password you entered is invalid");
}
}

import java.util.*;
public class Password
(
public static void main(String[] args){
Scanner input = new Scanner(System.in);
boolean valid = true;
System.out.println("Please enter a pasword: ");
String password = input.next();
int i = 0;
if (password.length() < 8){
System.out.println("Password must be at least 8 characters.");
valid = false;
}
while (i < password.length() && valid == true){
if ((password.charAt(i)>='a' && password.charAt(i)<='z') || (password.charAt(i)>='A' && password.charAt(i)<='Z') || (password.charAt(i)>= '0' && password.charAt(i)<='9')){
valid = true;
else (
valid = false;
System.out.println("Password must contain letters or numbers only. (a-z, A-Z, 0-9");
}
}
i++
}
if (valid == true){
System.out.println("Password Accepted!");
}
}
}
*Edit* I'm annoyed with how it doesn't include the spaces I added in with the } etc. I'm new to posting here so I don't know how to make it appear with the spaces.
. I fell in love with programming and try to learn as much as I can about it.
For game hacking I suggest C. To put your code in the blocks u have to put [.code.] and ending [./code.] without periods.