├── Collection-Q&A.pptx ├── Interview-QA.pptx ├── README.md ├── pom.xml └── src └── main └── java └── com └── javatechie ├── collection ├── CustomArrayList.java ├── CustomThread.java ├── FailFastList.java ├── FailFastMap.java ├── FinalListExample.java ├── IdComparator.java ├── NameComparator.java ├── NullKeyValue.java ├── RemoveDuplicateFromList.java ├── Student.java └── Test.java ├── exception ├── DataReader.java ├── ExceptionOrder.java ├── OrderNotFoundException.java ├── Test.java └── TryCatchFinallyReturnFlow.java ├── fundamentals ├── Demo.java ├── Employee.java ├── StringObject.java └── TestImmutableString.java ├── immutable ├── Address.java └── Employee.java ├── java8 ├── GooglePay.java ├── Payment.java ├── Paytm.java └── PhonePe.java ├── marker ├── DaoFramework.java ├── Deletable.java └── Entity.java └── oop ├── Child.java └── Parent.java /Collection-Q&A.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Java-Techie-jt/interview-qa/978850cf887d33c30faef31a3e3b7a807720e1cc/Collection-Q&A.pptx -------------------------------------------------------------------------------- /Interview-QA.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Java-Techie-jt/interview-qa/978850cf887d33c30faef31a3e3b7a807720e1cc/Interview-QA.pptx -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # interview-qa -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.javatechie.qa 8 | interview-questions-answer 9 | 1.0-SNAPSHOT 10 | 11 | 12 | 13 | org.apache.maven.plugins 14 | maven-compiler-plugin 15 | 16 | 8 17 | 8 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/collection/CustomArrayList.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.collection; 2 | 3 | 4 | import java.util.ArrayList; 5 | import java.util.HashSet; 6 | import java.util.Set; 7 | 8 | public class CustomArrayList extends ArrayList { 9 | 10 | @Override 11 | public boolean add(Object o) { 12 | if(this.contains(o)){ 13 | return true; 14 | }else{ 15 | return super.add(o); 16 | } 17 | } 18 | public static void main(String[] args) { 19 | 20 | CustomArrayList list1=new CustomArrayList(); 21 | list1.add(1); 22 | list1.add(1); 23 | list1.add(1); 24 | list1.add(2); 25 | 26 | System.out.println(list1); 27 | 28 | Set set=new HashSet<>(); 29 | Student s1=new Student(101,"Basant"); 30 | Student s2=new Student(101,"Basant"); 31 | Student s3=new Student(105,"Prakash"); 32 | set.add(s1); 33 | set.add(s2); 34 | set.add(s3); 35 | 36 | System.out.println(set); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/collection/CustomThread.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.collection; 2 | 3 | import java.util.Collections; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | 7 | public class CustomThread extends Thread { 8 | 9 | static Map map = new HashMap(); 10 | 11 | public void run() { 12 | try { 13 | Thread.sleep(1000); 14 | // Child thread trying to add 15 | // new element in the object 16 | map.put(103, "D"); 17 | } catch (InterruptedException e) { 18 | System.out.println("Child Thread going to add element"); 19 | } 20 | } 21 | 22 | public static void main(String[] args) throws InterruptedException { 23 | map.put(100, "A"); 24 | map.put(101, "B"); 25 | map.put(102, "C"); 26 | 27 | CustomThread customThread = new CustomThread(); 28 | customThread.start(); 29 | 30 | //main thread is iterating 31 | for (Object o : map.entrySet()) { 32 | Object s = o; 33 | System.out.println(s); 34 | Thread.sleep(1000); 35 | } 36 | System.out.println(map); 37 | } 38 | //Segment locking or bucket locking 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/collection/FailFastList.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.collection; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | import java.util.concurrent.CopyOnWriteArrayList; 7 | 8 | public class FailFastList { 9 | 10 | public static void main(String[] args) { 11 | 12 | List list = new CopyOnWriteArrayList<>(); 13 | list.add("a"); 14 | list.add("b"); 15 | 16 | Iterator iterator = list.iterator(); 17 | 18 | while (iterator.hasNext()) { 19 | String element = iterator.next(); 20 | System.out.println(element); 21 | list.add("c"); 22 | } 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/collection/FailFastMap.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.collection; 2 | 3 | import java.util.HashMap; 4 | import java.util.Iterator; 5 | import java.util.Map; 6 | import java.util.concurrent.ConcurrentHashMap; 7 | 8 | public class FailFastMap { 9 | 10 | public static void main(String[] args) { 11 | 12 | Map map = new ConcurrentHashMap<>(); 13 | map.put(1, "one"); 14 | map.put(2, "two"); 15 | 16 | // Getting an Iterator from map 17 | Iterator it = map.keySet().iterator(); 18 | 19 | while (it.hasNext()) { 20 | Integer key = (Integer) it.next(); 21 | System.out.println(key + " : " + map.get(key)); 22 | map.put(3, "three"); 23 | } 24 | } 25 | 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/collection/FinalListExample.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.collection; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | public class FinalListExample { 7 | 8 | public static void main(String[] args) { 9 | 10 | final List list=new ArrayList<>(); 11 | 12 | System.out.println(list); 13 | 14 | list.add("abc"); 15 | list.add("def"); 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/collection/IdComparator.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.collection; 2 | 3 | import java.util.Comparator; 4 | 5 | public class IdComparator implements Comparator { 6 | 7 | 8 | @Override 9 | public int compare(Student s1, Student s2) { 10 | if (s1.getId() == s2.getId()) { 11 | return s1.getName().compareTo(s2.getName()); 12 | } else if (s1.getId() > s2.getId()) { 13 | return 1; 14 | } else { 15 | return -1; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/collection/NameComparator.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.collection; 2 | 3 | import java.util.Comparator; 4 | 5 | public class NameComparator implements Comparator { 6 | @Override 7 | public int compare(Student o1, Student o2) { 8 | return o1.getName().compareTo(o2.getName()); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/collection/NullKeyValue.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.collection; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | import java.util.concurrent.ConcurrentHashMap; 6 | 7 | public class NullKeyValue { 8 | 9 | public static void main(String[] args) { 10 | 11 | Map map=new ConcurrentHashMap<>(); 12 | map.put(null,null); 13 | System.out.println(map); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/collection/RemoveDuplicateFromList.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.collection; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | import java.util.List; 6 | import java.util.Set; 7 | 8 | public class RemoveDuplicateFromList { 9 | 10 | 11 | public static void main(String[] args) { 12 | List tempList =new ArrayList<>(); 13 | List list =new ArrayList<>(); 14 | list.add("a"); 15 | list.add("b"); 16 | list.add("a"); 17 | System.out.println(list); 18 | 19 | Set set=new HashSet<>(list); 20 | System.out.println(set); 21 | 22 | for (String element:list){ 23 | if(!tempList.contains(element)){ 24 | tempList.add(element); 25 | } 26 | } 27 | 28 | System.out.println(tempList); 29 | 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/collection/Student.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.collection; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collections; 5 | import java.util.List; 6 | import java.util.Objects; 7 | 8 | public class Student implements Comparable { 9 | 10 | private int id; 11 | private String name; 12 | 13 | public Student(int id, String name) { 14 | this.id = id; 15 | this.name = name; 16 | } 17 | 18 | @Override 19 | public boolean equals(Object o) { 20 | if (this == o) return true; 21 | if (o == null || getClass() != o.getClass()) return false; 22 | Student student = (Student) o; 23 | return id == student.id && 24 | Objects.equals(name, student.name); 25 | } 26 | 27 | @Override 28 | public int hashCode() { 29 | return Objects.hash(id, name); 30 | } 31 | 32 | public int getId() { 33 | return id; 34 | } 35 | 36 | public void setId(int id) { 37 | this.id = id; 38 | } 39 | 40 | public String getName() { 41 | return name; 42 | } 43 | 44 | public void setName(String name) { 45 | this.name = name; 46 | } 47 | 48 | 49 | @Override 50 | public int compareTo(Student s) { 51 | if (id == s.id) { 52 | return 0; 53 | } else if (id > s.id) { 54 | return 1; 55 | } else { 56 | return -1; 57 | } 58 | } 59 | 60 | @Override 61 | public String toString() { 62 | return "Student{" + 63 | "id=" + id + 64 | ", name='" + name + '\'' + 65 | '}'; 66 | } 67 | 68 | 69 | public static void main(String[] args) { 70 | List students = new ArrayList<>(); 71 | Student s1 = new Student(101, "Basant"); 72 | Student s2 = new Student(109, "Santosh"); 73 | Student s3 = new Student(105, "Prakash"); 74 | Student s4 = new Student(98, "Ashik"); 75 | Student s5 = new Student(101, "Bikash"); 76 | students.add(s1); 77 | students.add(s2); 78 | students.add(s3); 79 | students.add(s4); 80 | students.add(s5); 81 | Collections.sort(students,new IdComparator()); 82 | System.out.println(students); 83 | 84 | } 85 | 86 | 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/collection/Test.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.collection; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.Map; 6 | import java.util.TreeMap; 7 | 8 | public class Test { 9 | 10 | public static void main(String[] args) { 11 | 12 | final List list=new ArrayList<>(); 13 | //parent parent=new Child();//runtime polymophisim 14 | 15 | list.add("a"); 16 | list.add("b"); 17 | 18 | System.out.println(list); 19 | 20 | Map map=new TreeMap<>(); 21 | map.put("a","xyz"); 22 | map.put("d","ksh"); 23 | map.put("b","lvjdf"); 24 | System.out.println(map); 25 | 26 | 27 | 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/exception/DataReader.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.exception; 2 | 3 | import java.io.*; 4 | 5 | public class DataReader { 6 | 7 | public static void main(String[] args) { 8 | 9 | File file=new File("C:\\Users\\basan\\Onerive\\Desktop\\jasypt-cmd"); 10 | 11 | try { 12 | BufferedReader br=new BufferedReader(new FileReader(file)); 13 | while(br.readLine()!=null){ 14 | System.out.println(br.readLine()); 15 | } 16 | } catch (FileNotFoundException e) { 17 | e.printStackTrace(); 18 | } catch (IOException e) { 19 | e.printStackTrace(); 20 | } 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/exception/ExceptionOrder.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.exception; 2 | 3 | public class ExceptionOrder { 4 | 5 | 6 | public static void main(String[] args) { 7 | 8 | try { 9 | System.out.println(10 / 0); 10 | } catch (Exception ex) { 11 | System.out.println(ex.getMessage()); 12 | // } catch (ArithmeticException ae) { 13 | // System.out.println(ae.getMessage()); 14 | // } finally { 15 | System.out.println("finally"); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/exception/OrderNotFoundException.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.exception; 2 | 3 | public class OrderNotFoundException extends Exception { 4 | 5 | public OrderNotFoundException(String message){ 6 | super(message); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/exception/Test.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.exception; 2 | 3 | public class Test { 4 | 5 | 6 | public void getOrder(int orderId) throws OrderNotFoundException { 7 | if(orderId==101){ 8 | throw new OrderNotFoundException("Order not found with id "+orderId); 9 | }else{ 10 | //do some logic 11 | } 12 | } 13 | 14 | 15 | public static void main(String[] args) throws OrderNotFoundException { 16 | Test test=new Test(); 17 | test.getOrder(101); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/exception/TryCatchFinallyReturnFlow.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.exception; 2 | 3 | public class TryCatchFinallyReturnFlow { 4 | 5 | public static int m1() { 6 | try { 7 | return 1; 8 | } catch (Exception ex) { 9 | return 2; 10 | }finally { 11 | System.exit(0); 12 | return 3; 13 | } 14 | } 15 | 16 | public static void main(String[] args) { 17 | System.out.println(m1()); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/fundamentals/Demo.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.fundamentals; 2 | 3 | public class Demo { 4 | 5 | private final int a=10; 6 | 7 | public void m1(){ 8 | //a=20;//can't reassign 9 | try { 10 | System.out.println("try block"); 11 | }finally { 12 | System.out.println("finally block"); 13 | //clean those stream 14 | } 15 | } 16 | 17 | @Override 18 | protected void finalize() throws Throwable { 19 | System.out.println("finalize method called..."); 20 | } 21 | 22 | public static void main(String[] args) { 23 | Demo demo=new Demo(); 24 | demo.m1(); 25 | //demo=null; 26 | System.gc(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/fundamentals/Employee.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.fundamentals; 2 | 3 | 4 | import java.util.HashSet; 5 | import java.util.Objects; 6 | import java.util.Set; 7 | 8 | public class Employee { 9 | 10 | private int id; 11 | private String name; 12 | 13 | public Employee() { 14 | } 15 | 16 | public Employee(int id, String name) { 17 | this.id = id; 18 | this.name = name; 19 | } 20 | 21 | public int getId() { 22 | return id; 23 | } 24 | 25 | public void setId(int id) { 26 | this.id = id; 27 | } 28 | 29 | public String getName() { 30 | return name; 31 | } 32 | 33 | public void setName(String name) { 34 | this.name = name; 35 | } 36 | 37 | @Override 38 | public boolean equals(Object o) { 39 | if (this == o) return true; 40 | if (o == null || getClass() != o.getClass()) return false; 41 | Employee employee = (Employee) o; 42 | return id == employee.id && 43 | Objects.equals(name, employee.name); 44 | } 45 | 46 | @Override 47 | public int hashCode() { 48 | return Objects.hash(id, name); 49 | } 50 | 51 | @Override 52 | public String toString() { 53 | return "Employee{" + 54 | "id=" + id + 55 | ", name='" + name + '\'' + 56 | '}'; 57 | } 58 | 59 | public static void main(String[] args) { 60 | 61 | Employee employee1 = new Employee(101, "Basant"); 62 | Employee employee2 = new Employee(101, "Basant"); 63 | 64 | System.out.println("is hashcode() same : " + (employee1.hashCode() == employee2.hashCode())); 65 | System.out.println("is equals() same : " + (employee1.equals(employee2))); 66 | 67 | 68 | Set employees=new HashSet<>(); 69 | employees.add(employee1); 70 | employees.add(employee2); 71 | System.out.println(employees); 72 | 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/fundamentals/StringObject.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.fundamentals; 2 | 3 | public class StringObject { 4 | 5 | public static void main(String[] args) { 6 | 7 | //how many object created here 8 | String s1=new String("javatechie"); 9 | //1 object -> new -> heap 10 | //2 object -> literal -> SCP (String constant pool area) 11 | 12 | String s2="javatechie"; 13 | // intern method used to get reference from SCP 14 | System.out.println(s1.intern()); 15 | System.out.println(s1.intern().hashCode()==s2.hashCode()); 16 | 17 | //total object count 2 18 | 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/fundamentals/TestImmutableString.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.fundamentals; 2 | 3 | public class TestImmutableString { 4 | 5 | public static void main(String[] args) { 6 | String s="Java";//-------1010 7 | s.concat(" Techie");//---------1020 8 | //concat() method appends the string at the end 9 | System.out.println(s);//will print Java because strings are immutable objects 10 | 11 | String password="pwd"; 12 | password.concat("123"); 13 | 14 | 15 | StringBuilder sb=new StringBuilder("Java"); 16 | sb.append(" Techie"); 17 | System.out.println(sb); 18 | 19 | //let's say 5 reference using this password , 20 | // now if we changed any in same value then all 5 reference will impacted 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/immutable/Address.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.immutable; 2 | //mutable class 3 | public class Address { 4 | 5 | private String city; 6 | private String zip; 7 | 8 | public Address() { 9 | } 10 | 11 | public Address(String city, String zip) { 12 | this.city = city; 13 | this.zip = zip; 14 | } 15 | 16 | public String getCity() { 17 | return city; 18 | } 19 | 20 | public void setCity(String city) { 21 | this.city = city; 22 | } 23 | 24 | public String getZip() { 25 | return zip; 26 | } 27 | 28 | public void setZip(String zip) { 29 | this.zip = zip; 30 | } 31 | 32 | @Override 33 | public String toString() { 34 | return "Address{" + 35 | "city='" + city + '\'' + 36 | ", zip='" + zip + '\'' + 37 | '}'; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/immutable/Employee.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.immutable; 2 | 3 | import java.util.*; 4 | import java.util.stream.Collectors; 5 | 6 | public final class Employee { 7 | 8 | private final String name; 9 | private final Date doj;//mutable 10 | private final List mobile; 11 | 12 | private final Address address; 13 | 14 | public Employee(String name, Date doj, List mobile, Address address) { 15 | this.name = name; 16 | this.doj = doj; 17 | this.mobile = mobile; 18 | this.address = address; 19 | } 20 | 21 | public String getName() { 22 | return name; 23 | } 24 | 25 | public Date getDoj() { 26 | return (Date) doj.clone(); 27 | } 28 | 29 | public List getMobile() { 30 | return new ArrayList<>(mobile); 31 | } 32 | 33 | public Address getAddress() { 34 | return new Address(address.getCity(),address.getZip()); 35 | } 36 | 37 | @Override 38 | public String toString() { 39 | return "Employee{" + 40 | "name='" + name + '\'' + 41 | ", doj=" + doj + 42 | ", mobile=" + mobile + 43 | ", address=" + address + 44 | '}'; 45 | } 46 | 47 | public static void main(String[] args) { 48 | Address address=new Address("blr","1012"); 49 | Employee employee=new Employee("Basant",new Date(), 50 | Arrays.stream(new String[]{"1234","5678"}).collect(Collectors.toList()), address); 51 | 52 | employee.getDoj().setDate(20); 53 | employee.getMobile().add("9010"); 54 | employee.getAddress().setCity("Pune"); 55 | 56 | System.out.println(employee); 57 | 58 | 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/java8/GooglePay.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.java8; 2 | 3 | public class GooglePay implements Payment { 4 | 5 | @Override 6 | public void doTransaction() { 7 | System.out.println("GPay transaction"); 8 | } 9 | 10 | 11 | 12 | public static void main(String[] args) { 13 | Payment payment=new GooglePay(); 14 | payment.addCoupon(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/java8/Payment.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.java8; 2 | 3 | public interface Payment { 4 | 5 | public void doTransaction(); 6 | 7 | /** 8 | * ignore if you don't want to add any addCoupon features in any of your impl 9 | * directly access from super class , if you want to use same impl 10 | * @Override addCoupon method if you want to provide different impl 11 | * **/ 12 | 13 | default void addCoupon() { 14 | System.out.println("add 5 RS cashback"); 15 | } 16 | 17 | static void generateTransactionReport(){ 18 | System.out.println("generate each transaction report"); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/java8/Paytm.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.java8; 2 | 3 | public class Paytm implements Payment { 4 | 5 | @Override 6 | public void doTransaction() { 7 | System.out.println("Paytm transaction"); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/java8/PhonePe.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.java8; 2 | 3 | public class PhonePe implements Payment { 4 | 5 | @Override 6 | public void doTransaction() { 7 | System.out.println("PhonePe transaction"); 8 | } 9 | 10 | @Override 11 | public void addCoupon() { 12 | System.out.println("10% cachback"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/marker/DaoFramework.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.marker; 2 | 3 | 4 | public class DaoFramework { 5 | 6 | public void delete(Object object){ 7 | 8 | if (object instanceof Deletable){ 9 | //write DB logic 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/marker/Deletable.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.marker; 2 | 3 | public interface Deletable { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/marker/Entity.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.marker; 2 | 3 | public class Entity implements Deletable{ 4 | 5 | //attributes 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/oop/Child.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.oop; 2 | 3 | public class Child extends Parent { 4 | 5 | public static void m2() { 6 | System.out.println("child static m1()"); 7 | } 8 | 9 | 10 | public static void main(String[] args) { 11 | Parent.m2(); 12 | Child.m2(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/javatechie/oop/Parent.java: -------------------------------------------------------------------------------- 1 | package com.javatechie.oop; 2 | 3 | public class Parent { 4 | 5 | public void m1() { 6 | System.out.println("Parent m1()"); 7 | } 8 | 9 | public static void m2() { 10 | System.out.println("Parent static m1()"); 11 | } 12 | 13 | private void test(){ 14 | 15 | } 16 | } 17 | --------------------------------------------------------------------------------