Posts

Interview challenge based on covered topics

OOP Concepts Create a class Car : Define attributes like make , model , and year , and include a method to display the car's details. Instantiate objects and display information for different cars. Design an Employee Management System: Create a base class Employee with properties like name , ID , and salary . Inherit from it to create a Manager class with additional properties like department . Library System: Create classes Book and Member . The Book class should have attributes like title and author , and the Member class should manage borrowing and returning books. Shape Hierarchy: Create a base class Shape with a method calculateArea() . Derive classes Circle , Rectangle , and Triangle from Shape , and implement the area calculation in each derived class. Student Class: Design a Student class with attributes like name , age , and marks . Create a derived class GraduateStudent that adds extra fields like thesis and calculate the final grade based on...

Interview questions based on covered topic 1

Here are 20 interview questions OOPs Concepts 1. What is Object-Oriented Programming (OOP), and what are its four main principles? 2. What is the difference between class and object in Java? 3. What is encapsulation in Java, and how does it work? 4. What is inheritance in Java? Can you give an example of it? 5. What is polymorphism? How does method overriding differ from method overloading in Java? 6. What is the difference between an abstract class and an interface in Java? 7. Can you explain the concept of constructor in Java? What is its purpose? 8. What is the role of this keyword in Java? How does it work inside constructors? 9. What is method overloading and method overriding? How are they different? 10. What is the super keyword used for in Java? --- If-Else 11. How does an if-else statement work in Java? Can you give an example? 12. What is the difference between if-else and switch-case in Java? 13. What happens if you use an if-else statement withou...

20 Programs (Program Statement + Steps, No Logic)

  20 Programs (Program Statement + Steps, No Logic) 1. Positive, Negative, or Zero Program Statement: Write a program to check whether a number is positive, negative, or zero. Steps: Take integer input n1 . Apply if–else if–else condition. Print result. 2. Voting Eligibility Program Statement: Write a program to check whether a person is eligible to vote. Steps: Take integer input age . Apply if–else condition. Print result. 3. Even or Odd Program Statement: Write a program to check whether a number is even or odd. Steps: Take integer input n1 . Apply if–else condition. Print result. 4. Vowel or Consonant Program Statement: Write a program to check whether a character is a vowel or consonant. Steps: Take character input ch . Apply if–else condition. Print result. 5. Leap Year Program Statement: Write a program to check whether a year is a leap year. Steps: Take integer input year . Apply if–else if–else cond...

Agenda to learn OOPS

 Got it 👍 Here are the main points only (no details) , well-structured for quick revision: 1. Methods (return type, parameters, overloading) Syntax of methods in Java Return types (void, primitive, object, array) Parameters (with/without, passing by value) Method Overloading Rules for Overloading Static vs Instance methods 2. Object-Oriented Programming (OOPs) Concepts Classes and Objects Class definition & members Object creation using new Accessing fields & methods Memory allocation Constructors Default constructor Parameterized constructor Constructor chaining ( this() , super() ) Constructor vs Method this & super keyword this → current object, variable differentiation, call constructor super → parent object, call constructor, access parent members Inheritance Code reusability extends keyword Types: Single, Multilevel, Hierarchical Constructors in inheritance Method overriding in inhe...

Wrapper methods programs

 Here are Java programs based on wrapper classes and their methods , showing only input and output : ✅ 1. Convert String to int Input: "123" Output: 133 String s = "123"; int num = Integer.parseInt(s); System.out.println(num + 10); ✅ 2. String to Integer object Input: "456" Output: 912 String s = "456"; Integer obj = Integer.valueOf(s); System.out.println(obj * 2); ✅ 3. Check if char is digit Input: '5' Output: It's a digit. char c = '5'; if(Character.isDigit(c)) { System.out.println("It's a digit."); } ✅ 4. Check if char is letter Input: 'a' Output: true char ch = 'a'; System.out.println(Character.isLetter(ch)); ✅ 5. Convert upper to lower Input: 'A' Output: 'a' char upper = 'A'; System.out.println(Character.toLowerCase(upper)); ✅ 6. Convert lower to upper Input: 'm' Output: 'M' char lower = 'm'; System....

Java string manipulation program titles, now with sample inputs :

L ist of 100 real-time Java string manipulation program titles , now with sample inputs  : 🔐 Authentication & Tokens Extract token value from API response string 🔸 Input: "token=abc123xyz; sessionId=xyz456;" Extract only digits from a token string 🔸 Input: "token=45gh6ab78;" Parse JWT and extract payload 🔸 Input: "eyJhbGci...eyJ1c2VyIjoiam9obiJ9..." Extract session ID from cookie string 🔸 Input: "JSESSIONID=58DFA0A2B54D5E85F39D;" Validate Bearer token format 🔸 Input: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." Remove prefix from access token 🔸 Input: "access_token=abc123xyz" Split authorization header into type and value 🔸 Input: "Basic YWxhZGRpbjpvcGVuc2VzYW1l" Check if token is expired using timestamp in string 🔸 Input: "exp=1718918400;" Parse OAuth callback URL and extract code 🔸 Input: "https://example.com/callback?code=12345abc" Extr...

String manipulation and character-based logic:

String  manipulation and character-based logic: 🔢 String Parsing and Extraction Extract all digits from a given string. Extract all letters from a string. Extract only uppercase letters from a string. Extract only lowercase letters from a string. Extract special characters from a string. Extract digits and return as an integer array. Extract words separated by a comma. Extract domain from an email string. Extract username from an email string. Extract numbers from a string and calculate their sum. 🔁 String Modification Replace all digits with * . Replace all vowels with # . Remove all spaces from a string. Remove duplicate characters from a string. Replace all occurrences of a word. Replace each character with its ASCII value. Replace uppercase letters with lowercase and vice versa. Insert a dash between every two digits. Add commas after every 3 digits in a number string. Format a string like a phone number: (123)...