Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners debugging techniques
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


umbrella.abc
debugging techniques
1 Answer(s)      2 years and 6 months ago
Posted in : Java Beginners


java program to accept the employee code from user and validate it according to the following logic. The first character of the employee code should be the letter 'E'. If it is any other letter, throw a user defined exception that displays an appropriate error message.


Advertisement
View Answers

June 15, 2012 at 5:15 PM


Here is an example that validates employee code. The given code accepts the code from the user and validate using regular expression. If the user starts the code with the capital letter E followed by other alphabets and numbers, then it will take otherwise it will show error message and allow the user to enter again.

import java.util.*;
class ValidateEmployee 
{
    public static boolean validateString(String st) {
                return st.matches("[E]+[a-zA-Z0-9]*");
        }



    public static void main(String[] args) 
    {
        Scanner input=new Scanner(System.in);
        System.out.print("Enter code: ");
        String code=input.next();
        while (validateString(code) != true) {
                        System.out.print("Invalid String!");
                        System.out.println();
                        System.out.print("Enter String: ");
                        code = input.nextLine();
                }
    }
}


Related Tutorials/Questions & Answers:
debugging techniques
debugging techniques  java program to accept the employee code from user and validate it according to the following logic. The first character of the employee code should be the letter 'E'. If it is any other letter, throw a user
debugging javascript - Java Beginners
debugging javascript  hi all, can anybody tell me which is the best way to debug javascript?  Hi Friend, Use IE8 beta. It is very powerful and works well. Thanks
Advertisements
Debugging in jsp? - JSP-Interview Questions
Debugging in jsp?  Hi Friends, am newbie to jsp.How to debug error in jsp
search and sort techniques in java
search and sort techniques in java  Hi i attened an interview recently... they asked to write all searching and sorting technique codes in java.. i said i would use collection frame work for it.. but they dosnt want me to use
start debugging problems related to the JDBC API
start debugging problems related to the JDBC API  How do I start debugging problems related to the JDBC API
RIAs Methods And Techniques
RIAs Methods And Techniques JavaScript It is the first major client side language technology that has the ability to run code and installed on several major of web clients. Earlier its uses were relatively limited but the development
a competitive study on cryptography techniques over block cipher
a competitive study on cryptography techniques over block cipher  i need "a competitive study on cryptography techniques over block cipher" project source code... plz reply to my post... for more information about this project
Business Analysis Techniques
There are many business analysis techniques that are quite useful in carrying out an effective and productive business analysis. Some of the important techniques for business analysis often used by business analysts are: PESTLE
[Mini-Project] Develop a programmer's editor in Java that supports syntax highlighting, compilation support, debugging support, etc.
[Mini-Project] Develop a programmer's editor in Java that supports syntax highlighting, compilation support, debugging support, etc.  Please reply me sir
Techniques used for Generating Dynamic Content Using Java Servlets.
Techniques used for Generating Dynamic Content Common Gateway Interface (CGI) For any web application high performance and timely delivery are key ingredients to competitive success.Earlier
Top 20 SEO Techniques for Google Search Ranks
, some of the good old SEO techniques have never been so important. Once again.... Though in presenting top SEO techniques for Google search ranks we are most likely... tools and techniques. Here is our pick on top SEO techniques for Google search
Web 2.0 Characteristics,Web 2.0 Applications,Web 2.0 Conference,Web 2.0 Tools,Web 2.0 Technologies,Web 2.0 Techniques
usually feature a number of following techniques: Rich Internet application techniques, optionally Ajaxbased Cascading Style Sheet, CSS Semantically valid
Techniques to Improve GPS Accuracy
Techniques to Improve GPS Accuracy       Introduction GPS is the best navigation and tracking... resolution techniques, the entire processing work done in real time. New
RIAs Methods And Techniques
RIAs Methods And Techniques       JavaScript It is the first major client side language technology that has the ability to run code and installed on several major of web
Search Engine Optimization (SEO) Techniques
Search Engine Optimization (SEO) Techniques Search engine optimization... include techniques which are recommended as good design techniques. While black hat techniques are those techniques which are not approved by search
FLABot
of the existing techniques to deal with debugging operate at the level of source code...; FLABot is a fault-localization and debugging tool for Eclipse plug-ins, which...) and supported by Intel Corporation. Project Description Debugging is one of the most
DDchange
DDchange       DDchange is an Debugging Framework that automatically determines why your program fails. Find out which change causes your program to fail: DDchange
Method
Method       In this section, we will explore the concept of method in the reference of object oriented programming techniques. As we earlier described in the topic class, a class have
Method in Java
Method in Java       In this section, we will explore the concept of method in the reference of object oriented programming techniques. As we earlier described in the topic class
Illatis StepIn - Debugger for MySQL procedures
, Eclipse based IDE that makes debugging MySQL stored procedures and functions... Debugging With StepIn section. It will guide you through the steps and you
Ensemble Glider for Eclipse
Ensemble Glider for Eclipse       An Eclipse plugin for rapid J2EE application development and debugging. Create and test EJBs and JSPs without
SmartInspect
logging tool for debugging and monitoring your projects and applications... SmartInspect is the perfect solution for debugging web applications, distributed
PHP Generate a pages loading time Tutorial
PHP Page Loading Time       In the given example we will learn how to generate and display the amount of time taken to load and display a specific page, for debugging or display
Printing a Stack Trace to the Server Console
the error instead of debugging jsp pages. By  the stack trace, you will know... getMessage() method of the exception to print errors during debugging process
ILOG Business Rule Studio
-editing and debugging of Java code and rules. Rule Studio supports deploying and debugging rulesets to Rule Execution Server and enables collaboration
Multicast in Java
Multicast in Java       Multicast in Java This section introduces you how to deliver or transmit data in network and describes the fundamental of various techniques like
Log4Fx
Log4Fx        Log4Fx component facilitates logging and debugging of your Flex application by letting you set up the logging on the client or server sides as well
Class
techniques. A class defines the properties of  objects and methods used... concept is employed in the object oriented techniques to create the objects through
How to Add Array Item in PHP
i)    PHP array add item In this PHP tutorial we will discuss about the different techniques to add item into an array.  array_push() is one of the widely used function to add item into an array.General format
 

 

 

DMCA.com