Posts

Showing posts from May, 2023

PM

Behavioural checks types 1. The Behavioural Event Interview Technique (BEI) STAR Method      Situation      Task      Action      Response 2. The Situational Interview Technique 7Cs of Communicaiton      Clear - State the aim distinctly      Concise - Keep communication short      Correct - Share accurate information      Complete - Include all relevant information      Concrete - Leave no threads hanging      Courteous - User polite words and language      Considerate - Allow the opportunity to respond SCAMPER to creativity      Substitute      Combine      Adapt      Modify      Put to other user      Eliminate      Reverse Creative Thinking Techniques      Brainstorming      Idea generatin...

Java Programs

Program to add prefix and suffix to the String? StringJoiner class, used to add prefix and suffix in a given String      StringJoiner stringJoiner = new StringJoiner(",", "#", "#");      stringJoiner.add("Interview");      stringJoiner.add("Questions");      stringJoiner.add("Answers");      System.out.println(stringJoiner); Program to Print ten random numbers using forEach? Use Random class to generate Random number      Random random = new Random();      random.ints().limit(10).forEach(System.out::println); Program to iterate a Stream using the forEach method?      List<String> str = Arrays.asList("Hello","Hola","Namaste","Hi");      str.stream().forEach(System.out::println); Program to find the Minimum and Maximum number of a Stream? To find minimum or maximum number in stream, use comparator.comparing() method which will take integer value from...

OOP OOAD

  Object  means a real-world entity such as a pen, chair, table, computer, watch, etc.  Object-Oriented Programming  is a methodology or paradigm to design a program using classes and objects. Object Any entity that has state and behavior is known as an object.  An Object can be defined as an instance of a class. An object contains an address and takes up some space in memory. Class Collection of objects is called class. It is a logical entity. Inheritance(IS-A) When one object acquires all the properties and behaviors of a parent object, it is known as inheritance.  It provides code reusability.  It is used to achieve runtime polymorphism. Polymorphism If one task is performed in different ways, it is known as polymorphism. Uuse method overloading and method overriding to achieve polymorphism. Abstraction Hiding internal details and showing functionality is known as abstraction. In Java, use abstract class and interface to achieve abstraction. Encapsu...

Design Patterns

A design pattern systematically names, motivates, and explains a general design that addresses a recurring design problem in object-oriented systems. A design patterns are well-proved solution for solving the specific problem/task. Use the design patterns during the analysis and requirement phase of SDLC. A design pattern provides a general reusable solution for the common problems that occur in software design. The idea is to speed up the development process by providing well-tested, proven development/design paradigms. The pattern typically shows relationships and interactions between classes or objects. By using design patterns, make code more flexible, reusable, and maintainable. Design patterns are categorized into two parts: I. Core Java (or JSE) Design Patterns. II. JEE Design Patterns Core Java Design Patterns There are 23 design patterns which can be classified in three categories. 1) Creational patterns - provide a way to create objects while hiding the creation logic, rathe...

Internal Workings

Internal working of ConcurrentHashMap The ConcurrentHashMap class is introduced in JDK 1.5 belongs to java.util.concurrent package, which implements ConcurrentMap as well as to Serializable interface. ConcurrentHashMap is a thread-safe implementation of the Map interface in Java. ConcurrentHashMap allows concurrent access to the map. A ConcurrentHashMap is divided into number of segments. Part of the map called Segment (internal data structure) is only getting locked while adding or updating the map. ConcurrentHashMap allows concurrent threads to read the value without locking at all. In ConcurrentHashMap, the Object is divided into a number of segments according to the concurrency level. The default concurrency-level of ConcurrentHashMap is 16. In ConcurrentHashMap, at a time any number of threads can perform retrieval operation but for updated in the object, the thread must lock the particular segment in which the thread wants to operate. This type of locking mechanism is known as Se...

Java Version Features

Java8 (LTS)  -  Java 8 was a massive release   There’s two main feature   Lambdas   functional interfaces   method references,   repeating annotations,   default methods for interfaces   static methods for interfaces   Stream API - functional-style operations for collections Java 9 (Support Ended)   Collections     Collections got a couple of new helper methods to easily construct Lists, Sets, and Maps.       List<String> list = List.of("one", "two", "three");       Set<String> set = Set.of("one", "two", "three");       Map<String, String> map = Map.of("foo", "one", "bar", "two");   Streams     Streams got a couple of additions, in the form of takeWhile, dropWhile, and iterate methods.       Stream<String> stream = Stream.iterate("", s -> s + "s").takeWhile(s -> s.length() < 10);   Optionals     Option...