string object

string object

Hi, how do i write a program that works with a user's password, when the program should prompt the user for a possible password, that is between 6 and 10 characters long, that contains at least one letter, and contains at least one digit?

View Answers

March 1, 2011 at 1:17 PM

Java Password Validation

import java.util.*;
import java.util.regex.*;

public class ValidatePassword{
      public static void main(String[]args){
          Scanner input=new Scanner(System.in);
          System.out.print("Enter password: ");
      String st=input.nextLine();
      Pattern p = Pattern.compile("((?=.*\\d)(?=.*[a-z][A-Z]).{6,10})");
      Matcher m = p.matcher(st);
      if(m.find()){
          System.out.println("Valid");
      }
      else{
          System.out.println("Not Valid");
      }
      }
     }









Related Tutorials/Questions & Answers:
string object
string object  Hi, how do i write a program that works with a user's password, when the program should prompt the user for a possible password, that is between 6 and 10 characters long, that contains at least one letter
object 2 string - Java Beginners
object 2 string  hi sir,how to convert object to string and how 2 compare object with null value to string with null value plz provide a program 4 this sir,plzzzzzzzzz
Advertisements
Convert Object To String
Convert Object To String       In this section, you will learn to convert an object to a string... This program helps you in converting an object type data into a string type data
String and stringbuffer object - Java Beginners
String and stringbuffer object  Hi, What is the basic difference between string and stringbuffer object? Thanks   Hi Friend, Differences: 1)String class is used to manipulate character strings that cannot
Converting object to String
Converting object to String In this section you will learn to convert Object to String in java. It is sometimes necessary to convert object to String because you need to pass it to the method that accept String only. Object is a class
Convert an Integer type object to a String object
Convert an Integer type object to a String object   ... the Integer type object to a String object using the Integer.toBinaryString...; Create a class "NumberFormats" where an integer type object is converted
Object representation in to String example
.style1 { font-size: medium; } Object representation in to String example:- We can represent any kind of object in the form of string. For this purpose we have used toString() method for any kind of object. User can see
how to convert xml string to soap request object using axis1.4?
how to convert xml string to soap request object using axis1.4?  how to convert xml string to soap request object using axis1.4
Java date to String, Convert date object into a string with a pattern
Convert date object into a string with a pattern This section illustrates you the conversion of date object into a string pattern. Java has provide many... string. For example, d -  denotes the day in month M- denotes the month
I retrieve a String or other object type without creating a new object each time.
I retrieve a String or other object type without creating a new object each time.  How can I retrieve a String or other object type without creating a new object each time
ReadLine(String fmt,Object... args) of Console class - Java Beginners
ReadLine(String fmt,Object... args) of Console class  How to reload the string and objects of console class in Java?  Hi friend,import... ConsoleExample{ public static void main(String[] args){ Console console
String intern()
() method returns a standard form representation of a string object. Basically... already contains a string equal to this String object as determined by the equals(Object) method then on invoking the intern method the string from the pool
object
object  is it possible to create object in the same class..?.   Yes, you can. class CreateObject { CreateObject(){ System.out.println("I have an object."); } public static void main(String[] args
how to get date format in string from date object containing real date in java
how to get date format in string from date object containing real date in java  i want to get data string format from date object where date object...(String[] args) { Date date=new Date(); SimpleDateFormat sdf1
how to get date format in string from date object containing real date in java
how to get date format in string from date object containing real date in java  i want to get data string format from date object where date object...(String[] args) { Date date=new Date(); SimpleDateFormat sdf1
STRING.....
STRING.....  plzz sent me d code for counting vowels in a string... gui programme
string
string   difference detween "public static void main (String[] args) " and "public static void main (String args[])" in java but it executes both... "String args[]" can mean a "string array called args which is an array
string
string  String helloString = new String(helloArray); System.out.println(helloString); i am unable to understand this. could u plz explain
string
string  a java program using string function to input any string... ArrangeStringAlphabetically { public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.print("Enter string
String
String  how to add spaces with string functions.?   Hi... { public static String addSpaceToRight(String s, int n) { return String.format("%1$-" + n + "s", s); } public static String addSpaceToLeft(String s, int n
String
characters in string?   import java.util.*; class RemoveDuplicateCharatcersFromString { public static String removeDuplicates(String s... < s.length(); i++) { String st = s.substring(i, i + 1
String
String  write down the code of remove any character from a given string without using any string function   please give me the code of remove any given character from a given string without using function
string
string   just i want to a program in a short form to the given string in buffered reader for example input string: Suresh Chandra Gupta output: S. C...; public class StringTest { public static void main(String [] args
string
*; class ExtractWords { public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.print("Enter String: "); String st=input.nextLine(); String str[]=st.split
string
string  a java program to input a string and display the string...*; import java.io.*; public class FirstLetter{ public static String capitalizeFirstLetter( String str ) { final StringTokenizer st = new StringTokenizer( str
String
String  How to Convert sunnapu gopal to Sunnapu Gopal in java using String
String
String  how to print in between numbers if the question "String s = "1,2,3,4,5,6,8,-25"" out must be 1 2,3,4,5,6,7,8,9,10,upto25
string
string  write a program to accept the string and store the reverse stream into another array and print
string
string  java prgm to find total occurence of a given string pattern in a sentence
string
string  java prgm to find total occurence of a given string pattern in a sentence
String
String  write a program using string it should replace 'c'char to integer number as 1 in whole source
string
and also displaying that contain word? Like I want to find "a" in the string... and a character. It then count the occurrence of that character in the string and display... String_Example { public static void main(String[] args
string
string  program for String reverse and replace in c,c++,java e.g.Input:10,20,hello output:hello;20;10   Hi Friend, Try the following java...(String[] args) { String array[]=new String[5]; Scanner input
string
string  a java program using string function that computes your initials from your full name and display them   Please visit the following links: http://www.roseindia.net/tutorial/java/core/printInitials.html
string
string  a java program using string function and access modifiers to automate the insurance company which will have to manage the information about policy holders Data Members: 1)Policy No 2)Name of policy holder 3)Address 4
Convert Object to Int
int. The parseInt() method of an Integer class takes a numeric string object... Convert Object to Int       In this section, we are going to learn to convert a numeric string type
Object Creations
Object Creations  String a[][]=new String[10][20]; The above line how many objects are created
String length property example
in the specified String object. In case of string null and empty, the string length... .style1 { font-size: medium; } String Length property example in Action Script3:- If user want to find out number of characters in a string
object of object class
object of object class  what do u mean by "object of object class
Java String Examples
Java String Examples      ... describes how two string references are compared. If two String variables point to the same object then these two variables are called references for the same object
String Ques
pool.It utilize memory in a better way with fulfilling object creation. While String st="abc" creates one object which goes to string pool.It consumes less memory. 2...") is a String Object. Thanks   Thank u very much
object array
object array  Hi i have array that is object[] obj= { new string...); (adsbygoogle = window.adsbygoogle || []).push({}); display(object{[] obj) {} Now my question is what is the string length and how to retrieve element from
(ii) String and String Buffer Class
between String and StringBuffer 1) String object is immutable whereas StringBuffer objects are mutable. 2) String objects are constants...String and String Buffer Class  difference between String and String
Java object
Java object  What is mutable object and immutable object?  An Immutable object is a kind of object whose state cannot be modified after it is created. This is as opposed to a mutable object, which can be modified
constructor or object
constructor or object  object or construct which create first?  ... Example { Example(String st){ System.out.println(st); } public static void main(String[] args) { Example ex=new Example1("Hello
Vector object[]
; // cast to array of Object if (splitVal != null) { String...Vector object[]  I want to create payslip in java public Vector...(); Object[] value = new Object[] {"Employee Name",f.ename.getSelectedItem
JSP Response Object
JSP Response Object  JSP response Object ?   The response object denotes the HTTP Response data. The result or the information of a request is denoted with this object. The response object handles the output
conver object to int
conver object to int  i have a method returns object but i need int how can convert ? notice:object not means string means object string str map.get(str)ADS_TO_REPLACE_1 returns object but i need an integer
JSP Application Object
of Application Object: getAttribute(String name) getAttributeNames() setAttribute(String objName, Object object) removeAttribute(String objName...JSP Application Object  JSP Application Object?   
object creation
object creation  when will java object is created? is it at runtime or compiletime

Ads