Search This Blog

Monday, July 14, 2025

Java Regular Expressions - Quiz

 What will be the output of this regular expression (Java) code?

1. /*

 2. * Code by Nancy K.A.N.

 3. */

 4. import java.util.regex.Matcher;

 5. import java.util.regex.Pattern;

 6.  

 7. public class RegexSubStringTest {

 8.     public static void main(String[] args) {

 9.         String str1 = "This is an example of 'Java Regular Exressions'";

10.         Pattern pattern = Pattern.compile("'(.*?)'");

11.         Matcher matcher = pattern.matcher(str1);

12.         if (matcher.find())

13.         {

14.             System.out.println(matcher.group(1));

15.         }

16.     }

17. }

18.  

Created by Nancy K.A.N.

@17:13 14-Jul-2025


Follow my YouTube channel: @CodeWithNancy



Sunday, July 13, 2025

Bitwise Shift Operators - 1

 What is the output of the following code?

/**

  * @author Nancy K.A.N.

 */

public class BitwiseDemo1 {

    public static void main(String[] args) {

        int a =4;

        int b = a<<3;

        System.out.println(b);

    }

}


By Nancy K.A.N.

@22:06 13-Jul-2025


Follow my YouTube channel @CodingWithNancy

Friday, July 11, 2025

Product Life Cycle Stages

The software industry accepts and follows the following life cycle stages for a product:

1. Project proposal

2. Requirement gathering and analysis

3. Designing

4. Code development

5. Testing

6. Implementation

7. Maintenance

8. End Of Life (EOL)

8-A An entirely new product or another product with better features


Created by Nancy K.A.N.

@15;42 11-Jul-2025

Follow on YouTube Coding With Nancy

Thursday, July 10, 2025

Some Acronyms - Programming practices

DRY - Don't Repeat Yourself

KISS - Keep It Simple Stupid

SLAP - Single Level Abstraction Principle

SOLID - contains five principles (SRP, OCP, LSP, ISP, DIP)

SRP - Single Responsibility Principle

OCP - Open-Closed Principle

LSP - Liskov Substitution Principle

ISP - Interface Segregation Principle

DIP - Dependency Inversion Principle


Created by Nancy K.A.N.

@21:17 10-Jul-2025

Follow on YouTube Coding With Nancy

Wednesday, July 9, 2025

Java Best Practices

In Java, what are the best practices for naming classes and variables?

a)  Upper Camel case for class names

b) Lower camel case for class names

c) Upper Camel case for variable names

d) Lower Camel case for variable names

e) all lowercase for class names as well as variable names


Created by Nancy K.A.N.

@19:10 09-Jul-2025

Follow on YouTube Coding With Nancy

Tuesday, July 8, 2025

Java Platform - 1

 Java incorporated platform independence by ___________________.

a) Interfaces 

b) classes

c) Java Native Interface

d) Java Virtual Machine


Created by Nancy K.A.N.

@13:39 08-Jul-2025

Follow on YouTube Coding With Nancy

Monday, July 7, 2025

Java Interfaces Default Methods

 In which Java version were the interface default methods introduced?

a) Java 7

b) Java 8

c) Java 9

d) Java 11


Created by Nancy K.A.N.

@17:32 07-Jul-2025

Follow on YouTube Coding With Nancy