Java Basics Regular Expressions
A regular expression (RE) is a pattern used to search through text. It either matches the text (or part of it), or fails to match you can easily extract the matching parts, or change them REs are not easy to use at first they're like a different programming language inside Java But, REs bring so much power to string manipulation that they are worth the effort.
Regular Expression Example
Regular Expression Pattern & Matcher
Regular Expression Pattern & Matcher
Regular Expression Example
Methods
Methods Naming
Method Declaration
Methods Method Examples A method that add two numbers. A method sort an array from 1 to 10. A method telling even or odd number. A method printing some message. A method reads from file.
Main Method Every program has a main method. Execution of the program is started from main method. If main method is not defined the program will never execute. There are two types of methods Return a value next = keyboard.nextInt(); keyboard is the calling object. Don’t return a value, called void method System.out.println(“Enter data:”); System.out is the calling object
Void Method Example
Method Returning Value Example