Creating a Java One Line Code
Not what you're looking for?
I have the following code:
public static void main (String [] args)
{
String s;
boolean b;
JOptionPane jop;
jop = new JOptionPane();
s = jop.showInputDialog("Enter your email address");
b = s.matches(".*@.*..*");
if (b)
{
System.out.println("Address Appears Valid");
}
else
{
System.out.println("Address is Invalid");
}
}
Question: How do I rewrite this main method so is uses as few lines of code as possible, preferably a single line?
Purchase this Solution
Solution Summary
This solution provides the coding which is required for the computer science question being asked. The solution illustrates how code can be re-written to fit into one line.
Solution Preview
public static void main(String[] args) ...
Purchase this Solution
Free BrainMass Quizzes
Javscript Basics
Quiz on basics of javascript programming language.
Basic UNIX commands
Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.
Word 2010: Tables
Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.
C++ Operators
This quiz tests a student's knowledge about C++ operators.
C# variables and classes
This quiz contains questions about C# classes and variables.