Question
How many lexemes does the following Java code contain? public class RectArea { public static double...

Answers
Lexemes:- Lexemes are the collection of words and symbols in a programming language. These can be anything like identifier, number, string or character.
Number of lexemes:-
1. public class RectArea {
In line 1 there are 4 lexemes, as we can count one by one like public, class, RectArea, and {.
2. public static double area (double length, double width) {
In line 2 there are 12 lexemes, as we can count like public, static, double, area, (, double, length, , , double, width, ), {.
3. double area=0.0;
In line 3 there are 5 lexemes. we can count as above.
4. try {
In line 4 there are 2 lexemes.
5. area=width*height;
In line 5 there are 6 lexemes.
6. } catch(Exception e) {
In line 6 there are 7 lexemes.
7. System.out.println("Error in RectArea.area: " +
In line 7 there are 15 lexemes.
8. e.getMessage());
In line 8 there are 7 lexemes.
9. System.exit(1);
In line 9 there are 7 lexemes.
10. }
In line 10 there are 1 lexemes.
11. return area;
In line 11 there are 3 lexemes.
12. }
In line 12 there are 1 lexemes.
13. }
In line 13 there are 1 lexemes.