Switch case statement in Java

A switch statement is a conditional statement that tests against multiple cases and displays one or multiple outputs based on the matching circumstances. Unlike if-then and if-then-else statements, the switch statement can work with byte, short, char, and int primitive data types. It also works with enum types (discussed in Java Enum), the String class, and a few wrapper classes: Character, Byte, Short, and Integer. Important Rules Only constants or literals are allowed in case Duplicate …

Switch case statement in Java Read More »

Data types in Java

Java is a statically-typed language, which means that all variables must first be declared before they can be used. It means the variable’s name and types must be defined before it can be used in code. boolean bool = true; By writing the above line we are telling the program that a variable named bool …

Data types in Java Read More »

10l. Advanced WebDriver – Using Log4j Part 2

This is a continuation of the article, ‘Using Log4j Part 1’ and hence, I suggest that you read part 1 before proceeding any further to get a grip on what’s happening. Scenario Configure Log4j.properties file, Log level – DEBUG Loggers – rootLogger and SeleniumTestLogger Appender – RollingFileAppender Layout – PatternLayout Write a JUnit4 test case, ‘Log4jTest.java’, …

10l. Advanced WebDriver – Using Log4j Part 2 Read More »

Java 8 Functional Interfaces

Introduction to functional interfaces A functional interface is an interface that has a single abstract method.  Functional interfaces can have multiple static and default methods, but they should have only one abstract method to qualify as a functional interface. Functional interfaces were introduced in Java 8 in order to implement lambda expressions.

Scroll to Top