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 defined exception that displays an appropriate error message.

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
ModuleNotFoundError: No module named 'django-debugging'
ModuleNotFoundError: No module named 'django-debugging'  Hi, My... named 'django-debugging' How to remove the ModuleNotFoundError: No module named 'django-debugging' error? Thanks   Hi, In your
What are data science techniques?
What are data science techniques?  Hi, I am beginner in Data Science... are data science techniques? Try to provide me good examples or tutorials links so that I can learn the topic "What are data science techniques?"
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
Debugging in jsp? - JSP-Interview Questions
Debugging in jsp?  Hi Friends, am newbie to jsp.How to debug error in jsp
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
ModuleNotFoundError: No module named 'remote-debugging-path-chromium'
ModuleNotFoundError: No module named 'remote-debugging-path-chromium' ...: No module named 'remote-debugging-path-chromium' How to remove the ModuleNotFoundError: No module named 'remote-debugging-path-chromium' error
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
com.exasol - udf-debugging-java version 0.3.0 Maven dependency. How to use udf-debugging-java version 0.3.0 in pom.xml?
com.exasol  - Version 0.3.0 of udf-debugging-java Maven dependency? How to use  com.exasol  - Version 0.3.0 of udf-debugging-java in pom.xml? How to use udf-debugging-java version 0.3.0 in pom.xml? Learn to use
Maven Repository/Dependency: com.exasol | udf-debugging-java
Maven Repository/Dependency of Group ID com.exasol and Artifact ID udf-debugging-java. Latest version of com.exasol:udf-debugging-java dependencies. # Version Release Date 1
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
Java code debugging
Maven dependency for com.exasol - udf-debugging-java version 0.6.4 is released. Learn to use udf-debugging-java version 0.6.4 in Maven based Java projects
Maven dependency for  com.exasol  - Version 0.6.4 of udf-debugging-java released The developers of   com.exasol - udf-debugging-java..., the released version of  com.exasol - udf-debugging-java library is 0.6.4. Developer
Maven dependency for com.exasol - udf-debugging-java version 0.6.1 is released. Learn to use udf-debugging-java version 0.6.1 in Maven based Java projects
Maven dependency for  com.exasol  - Version 0.6.1 of udf-debugging-java released The developers of   com.exasol - udf-debugging-java..., the released version of  com.exasol - udf-debugging-java library is 0.6.1. Developer
Maven dependency for com.exasol - udf-debugging-java version 0.4.1 is released. Learn to use udf-debugging-java version 0.4.1 in Maven based Java projects
Maven dependency for  com.exasol  - Version 0.4.1 of udf-debugging-java released The developers of   com.exasol - udf-debugging-java..., the released version of  com.exasol - udf-debugging-java library is 0.4.1. Developer
Maven dependency for com.exasol - udf-debugging-java version 0.6.6 is released. Learn to use udf-debugging-java version 0.6.6 in Maven based Java projects
Maven dependency for  com.exasol  - Version 0.6.6 of udf-debugging-java released The developers of   com.exasol - udf-debugging-java..., the released version of  com.exasol - udf-debugging-java library is 0.6.6. Developer
Maven dependency for com.exasol - udf-debugging-java version 0.6.5 is released. Learn to use udf-debugging-java version 0.6.5 in Maven based Java projects
Maven dependency for  com.exasol  - Version 0.6.5 of udf-debugging-java released The developers of   com.exasol - udf-debugging-java..., the released version of  com.exasol - udf-debugging-java library is 0.6.5. Developer
Maven dependency for com.exasol - udf-debugging-java version 0.6.3 is released. Learn to use udf-debugging-java version 0.6.3 in Maven based Java projects
Maven dependency for  com.exasol  - Version 0.6.3 of udf-debugging-java released The developers of   com.exasol - udf-debugging-java..., the released version of  com.exasol - udf-debugging-java library is 0.6.3. Developer
Maven dependency for com.exasol - udf-debugging-java version 0.6.2 is released. Learn to use udf-debugging-java version 0.6.2 in Maven based Java projects
Maven dependency for  com.exasol  - Version 0.6.2 of udf-debugging-java released The developers of   com.exasol - udf-debugging-java..., the released version of  com.exasol - udf-debugging-java library is 0.6.2. Developer
Maven dependency for com.exasol - udf-debugging-java version 0.6.0 is released. Learn to use udf-debugging-java version 0.6.0 in Maven based Java projects
Maven dependency for  com.exasol  - Version 0.6.0 of udf-debugging-java released The developers of   com.exasol - udf-debugging-java..., the released version of  com.exasol - udf-debugging-java library is 0.6.0. Developer
Maven dependency for com.exasol - udf-debugging-java version 0.5.0 is released. Learn to use udf-debugging-java version 0.5.0 in Maven based Java projects
Maven dependency for  com.exasol  - Version 0.5.0 of udf-debugging-java released The developers of   com.exasol - udf-debugging-java..., the released version of  com.exasol - udf-debugging-java library is 0.5.0. Developer
Maven dependency for com.exasol - udf-debugging-java version 0.4.0 is released. Learn to use udf-debugging-java version 0.4.0 in Maven based Java projects
Maven dependency for  com.exasol  - Version 0.4.0 of udf-debugging-java released The developers of   com.exasol - udf-debugging-java..., the released version of  com.exasol - udf-debugging-java library is 0.4.0. Developer
[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
website may usually feature a number of following techniques: Rich Internet application techniques, optionally Ajaxbased Cascading Style Sheet, CSS
Techniques to Improve GPS Accuracy
Techniques to Improve GPS Accuracy       Introduction GPS is the best navigation and tracking... techniques, the entire processing work done in real time. ADS_TO_REPLACE_5 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
Tips for Successful Outsourcing,Useful Tips of Successful Outsourcing,Tips and Techniques for Successful Outsourcing
FLABot
, most of the existing techniques to deal with debugging operate at the level...; FLABot is a fault-localization and debugging tool for Eclipse plug-ins, which...) and supported by Intel Corporation.ADS_TO_REPLACE_1 Project Description Debugging
DDchange
DDchange       DDchange is an Debugging Framework that automatically determines why your program fails. Find out which change causes your program to fail:ADS_TO_REPLACE_1
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
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
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
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... and distributed systems SmartInspect is the perfect solution for debugging web
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
Printing a Stack Trace to the Server Console
trace to catch the error instead of debugging jsp pages. By  the stack trace... debugging process, you can use printStackTrace() method which prints a stack trace
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
ModelOps Tutorial
In this section we are going to learn fast growing ModelOps techniques which are used... to be trending technologies in 2021 and Data Scientist must learn the techniques... are going to learn ModelOps techniques and see how it can be used
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
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
Guest Posting Tutorial - Getting Started with Guest Posting
/blogging is legitimate SEO techniques. What are the steps of guest posting? Now
Class
techniques. A class defines the properties of  objects and methods used..._TO_REPLACE_1 The same concept is employed in the object oriented techniques to create
JS-Sorcerer: JavaScript Development Tool
or Ajax application, and less time testing and debugging it. Read about its
Altova XMLSpy
and XML development environment for modeling, editing, debugging, and transforming... need a tool for creating, editing, and debugging XML-related technologies
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

Ads