Java interface programming questions

  • We can develop interfaces by using "interface" keyword. 
  • A class will implements all the methods in an interface.
  • By default interface methods are abstract.
  • Lets see some interesting java programming interview questions on interfaces.
  • Interface programming questions in java




Java interface interview programs part 1: interface programming java

Program #1: what will happen if we define normal methods in interface

  1. package interfaceinverviewprograms.instanceofjava;
  2. public interface A{
  3.  
  4. /**
  5. * @java interface  interview programming  questions and answers for freshers and experienced
  6.  */
  7.   
  8. void show() {
  9.         
  10.         System.out.println("Hello world");
  11.  
  12.     }
  13. }





Program #2:java interview programs to practice: Non static variables in interface

  1. package interfaceinverviewprograms.instanceofjava;
  2. public interface A{
  3.  
  4. /**
  5. * @java interface  interview programming  questions and answers for freshers and experienced
  6.  */
  7.   
  8. int a,b;

  9. }





Program #3:java interview programs to practice: which modifiers interface allows

  1. package interfaceinverviewprograms.instanceofjava;
  2. public interface A{
  3.  
  4. /**
  5. * @java interface  interview programming  questions and answers for freshers and experienced
  6.  */
  7.   
  8. private int x;
  9. protected int y;

  10. }





Program #4:java interview programs to practice: interface allows constructor?

  1. package interfaceinverviewprograms.instanceofjava;
  2. public interface A{
  3.  
  4. /**
  5. * @java interface  interview programming  questions and answers for freshers and experienced
  6.  */
  7. A(){
  8.  
  9. }

  10. }





Exception handling in method overriding in java

  • Defining multiple methods with same name and same signature in super class and sub class known as method overriding.
  • When Overriding a method there is a chance of having statements which may cause exceptions so we need to handle those inside method.
  • Otherwise simply we can give responsibility of handling exceptions to calling method.
  • We can give the responsibility of handling exceptions of a method to calling place by using throws keyword in java.
  • Now we are going to discuss about exception handling in method overriding in java.
  • When am method is overridden in sub class and super class method having throws exception. Then we have some scenarios to discuss.



1.Super class method not throwing any exceptions.
2.Super class method  throws exceptions.


1.Super class method  Not throwing any exceptions.
  • When super class method not throws ant exception,
  • We can add throws unchecked exception in sub class overridden method.
  • We can not add throws checked exception.

Program #1: When super class method does not have any throws exception then we can add throws un checked exception in subclass overridden method.

  1. package exceptionhandlingmethodoverridingjava;
  2. public class Super {
  3.  
  4.     /**
  5.      * @author www.instanceofjava.com
  6.      * @category throws in method overriding java
  7.      */
  8.     
  9.     
  10. public void show(){
  11.         
  12.  System.out.println("Super class show() method");
  13.  
  14. }
  15.  
  16. }

  1. package exceptionhandlingmethodoverridingjava;
  2. public class Sub extends Super {
  3.  
  4. /**
  5. * @author www.instanceofjava.com
  6. * @category throws in method overriding java
  7. */
  8.     
  9. public void show() throws NullPointerException{
  10.         
  11.         System.out.println("Sub class show() method");
  12.  }

  13. public static void main(String[] args) {
  14.  
  15.    Sub obj = new Sub();
  16.     obj.show();
  17.  
  18. }
  19.  
  20. }
Output:

  1. Sub class show() method


Program #2: When super class method does not have any throws exception then we can not add throws checked exception in subclass overridden method.

  1. package exceptionhandlingmethodoverridingjava;
  2. public class Super {
  3.  
  4.     /**
  5.      * @author www.instanceofjava.com
  6.      * @category throws in method overriding java
  7.      */
  8.     
  9.     
  10. public void show(){
  11.         
  12.  System.out.println("Super class show() method");
  13.  
  14. }
  15.  
  16. }

Exception handling in method overriding throws



2.Super class method  throws exceptions.

  • If super class method throws checked exceptions sub class overridden method can throw same exception , sub class exception or no exception but can not declare parent exception.
  • If super class method throws unchecked exceptions then no rules.


Program #3: When super class method  throws checked exception then we can add throws  checked exception in subclass overridden method.

  1. package exceptionhandlingmethodoverridingjava;
  2. public class Super {
  3.  
  4.     /**
  5.      * @author www.instanceofjava.com
  6.      * @category throws in method overriding java
  7.      */
  8.     
  9.     
  10. public void show() throws IOException{
  11.         
  12.  System.out.println("Super class show() method");
  13.  
  14. }
  15.  
  16. }

  1. package exceptionhandlingmethodoverridingjava;
  2. public class Sub extends Super {
  3.  
  4. /**
  5. * @author www.instanceofjava.com
  6. * @category throws in method overriding java
  7. */
  8.     
  9. public void show() throws IOException{
  10.         
  11.         System.out.println("Sub class show() method");
  12.  }

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

  14.  
  15.    Sub obj = new Sub();
  16.  
  17.  try {
  18.             obj.show();
  19. } catch (IOException e) {
  20.          
  21.             e.printStackTrace();
  22. }
  23.  
  24. }
  25.  
  26. }
Output:

  1. Sub class show() method

Program #4: When super class method  throws unchecked exception then we can not add throws  checked exception in subclass overridden method.

  1. package exceptionhandlingmethodoverridingjava;
  2. public class Super {
  3.  
  4.     /**
  5.      * @author www.instanceofjava.com
  6.      * @category throws in method overriding java
  7.      */
  8.     
  9.     
  10. public void show() throws ArithmeticException{
  11.         
  12.  System.out.println("Super class show() method");
  13.  
  14. }
  15.  
  16. }


throws in method overriding java


Program #5: When super class method  throws checked exception then we can not add throws its  parent exception in subclass overridden method.

  1. package exceptionhandlingmethodoverridingjava;
  2. public class Super {
  3.  
  4.     /**
  5.      * @author www.instanceofjava.com
  6.      * @category throws in method overriding java
  7.      */
  8.     
  9.     
  10. public void show() throws FileNotFoundException{
  11.         
  12.  System.out.println("Super class show() method");
  13.  
  14. }
  15.  
  16. }

  1. package exceptionhandlingmethodoverridingjava;
  2. public class Sub extends Super {
  3.  
  4. /**
  5. * @author www.instanceofjava.com
  6. * @category throws in method overriding java
  7. */
  8.     
  9. public void show() throws IOException{
  10.         
  11.         System.out.println("Sub class show() method");
  12.  }

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

  14.  
  15. Sub obj = new Sub();
  16.  
  17. try {
  18.            obj.show();
  19. } catch (Exception e) {
  20.           
  21.             e.printStackTrace();
  22. }
  23.  
  24. }
  25.  
  26. }

Yahoo sold to US telecoms giant Verizon

22nd July 2016:

  • Verizon is closing in on a deal to buy Yahoo’s core business for about $5 billion.
  • The value of the deal is reportedly around $5 billion for the core parts of Yahoo.
  • Verizon communications ready to pay  around $5 billion for yahoo's core business in search, email, advertising and media.
  • The $3 billion offer Verizon is expected to make next second bid is lower than the $4 billion to $8 billion bids that Yahoo’s Internet business, which includes its news sites and ad business. 

25th July 2016:

  • Yahoo agreed to sell its core operating business to Verizon for $4.8 billion on today morning.
  • US internet firm Yahoo is being acquired by American telecom's giant Verizon Communications for $4.8 billion.
  • "I love Yahoo, and I believe in all of you," Mayer said in a statement. "It’s important to me to see Yahoo into its next chapter."
  • Here Is Marissa Mayer's Final Letter To Yahoo Employees

Yahoo !!
  • 1994 Yahoo - which stands for Yet Another Hierarchically Organized Oracle - is founded
  • 2000 Yahoo valued at $125bn at height of dot.com boom
  • 2002 Google rejects a $3bn bid from Yahoo
  • 2008 Microsoft's $44.6bn offer for Yahoo is turned down
  • 2013 Blogging site Tumblr acquired by Yahoo for $1.1bn
  • 2015 Yahoo makes net loss of $4.4bn
  • 2016 Verizon agrees $4.8bn deal to buy Yahoo




verizon yahoo finance

What happened to Yahoo? 

  • On 18th July yahoo posted a deep loss which explains the challenges facing a potential acquirer of the shrinking internet business.
  • Yahoo loosing its visitors day by day if we observe internet search visitors statistics.

Loosing visitors :

  • Yahoo value lies in its users. But now it is loosing visitors and no more competition to google and Facebook. Yahoo losts its competitive edge
  • Analysis of the statistics from last decade shows how yahoo loosing its advertising revenue and search traffic.
  • Yahoo search engine share decreased from 42% to 12%.
  • Revenue share dropped from 25% to 3%.
verizon yahoo deal


The Company is Shrinking:

  • In 2015 its $4.4 loss in annual net income.
  • Yahoo hired Marissa mayer from google to get some positive results but she but it became largely unsuccessful.
  • Yahoo fired key people also resigned some key people because of pressure from share holders.
  • The company has sixth decline in last seven periods.


So Its Verizon Yahoo !

  • SunTrust analyst Robert Peck recently estimated that Verizon would lay off upwards of 40% of Yahoo’s 10,000 full-time employees (in order to save roughly $2 billion).
  • “Google has access to me on my mobile phone but is kind of missing the cable box and internet access data that Verizon has,” said Shar VanBoskirk, a digital marketing analyst at the research firm Forrester.


How to open notepad using java program

  • Notepad is a text editor from windows operating system. We use notepad for writing text files.
  • We can open a new notepad using java code.
  • By using the concept of running another application by Runtime class in java.
  • By creating object of runtime and calling  exec() method by passing application name.
  • Lets see how to open a notepad using java code




Program #1: Java example program to open notepad


  1. package interestingJavaprograms;
  2. import java.io.IOException;
  3.  
  4. public class NotepadJava {
  5.  
  6.     /**
  7.      * @ www.instanceofjava.com
  8.      * @ how to open a new notepad using java program
  9.      */
  10. public static void main(String[] args) {
  11.        
  12.           Runtime rt = Runtime.getRuntime();
  13.           
  14. try {
  15.       rt.exec("notepad");
  16. }
  17.  catch (IOException ex) {
  18.  
  19.  System.out.println(ex);
  20.  
  21. }  
  22.  
  23. }
  24.  
  25. }

 Output:

open notepad using java


Program #2: Java example program to open notepad and after 2 seconds close it.


  1. package interestingJavaprograms;
  2. import java.io.IOException;
  3.  
  4. public class NotepadJava {
  5.  
  6.     /**
  7.      * @ www.instanceofjava.com
  8.      * @ how to open a new notepad using java program
  9.      */
  10. public static void main(String[] args) throws InterruptedException, IOException {
  11.         
  12. Runtime runTime = Runtime.getRuntime();
  13. System.out.println("Opening notepad");
  14. Process process = runTime.exec("notepad");
  15.           
  16. try {
  17.  
  18.  
  19. Thread.sleep(200); 

  20.  process.destroy();
  21.  System.out.println("Closing notepad");
  22.  
  23. }
  24.  catch (Exception ex) {
  25.  
  26.  System.out.println(ex);
  27.  
  28. }  
  29.  
  30. }
  31.  
  32. }

  • We can open already existing notepad also for that we need to specify notepad.exe location and path of the destination file.
  • We need to pass these two parameters  to exec method of runtime class.
  • runTime.exec("C:\\Windows\\System32\\notepad.exe E:\\Samplenotepad.txt");

Program #3: Java example program to open exiting notepad txt file.


  1. package interestingJavaprograms;
  2. import java.io.IOException;
  3.  
  4. public class NotepadJava {
  5.  
  6.     /**
  7.      * @ www.instanceofjava.com
  8.      * @ how to open a new notepad using java program
  9.      */
  10. public static void main(String[] args) {
  11.        
  12.           Runtime rt = Runtime.getRuntime();
  13.           
  14. try {
  15.    runTime.exec("C:\\Windows\\System32\\notepad.exe E:\\Samplenotepad.txt");
  16. }
  17.  catch (IOException ex) {
  18.  
  19.  System.out.println(ex);
  20.  
  21. }  
  22.  
  23. }
  24.  
  25. }

Java program to remove vowels from string java

  • java program to remove vowels from a string
  • To remove vowels from a string we can use predefined method of string  replaceAll()
  • By passing all vowels to the method replaceAll() with empty it will replaces all vowels with empty. 
  • Check below topic for more programs on string 
  • Java Experience interview programs on strings



 Program #1: Java example program to remove all vowels from a String



  1. package inheritanceInterviewPrograms;
  2. public class RemoveVowels {
  3.  
  4.     /**
  5.      * @www.instanceofjava.com 
  6.      * @String interview programs asked in interviews
  7.      * @Remove vowels from a string in java
  8.      */
  9.  
  10.  public static void main(String[] args) {
  11.  
  12.         String str = "RemoveVowels";
  13.         String resustr = str.replaceAll("[aeiouAEIOU]", "");
  14.         System.out.println(resustr);
  15.  
  16.     }
  17.  
  18. }

 Output:


  1. RmvVwls

Program #2: Java example program to remove all vowels from a String by taking input from user


remove vowels from string

Java program to reverse vowels of a string


Program : Java example program to Reverse Vowels  in a String



  1. package inheritanceInterviewPrograms;
  2. /*
  3.  * @www.instanceofjava.com
  4.  */
  5. public class ReverseVowels {
  6.     public static String reverseVowels(String string) {
  7.  
  8.         String vowelsStr = "aeiouAEIOU";
  9.  
  10.         int lo = 0;
  11.         int hi = string.length() - 1;
  12.         char[] ch = string.toCharArray();
  13.  
  14.  while (lo < hi) {
  15.  
  16.      if (!vowelsStr.contains(String.valueOf(string.charAt(lo)))) {
  17.                 lo++;
  18.                 continue;
  19.        }
  20.  
  21.     if (!vowelsStr.contains(String.valueOf(string.charAt(hi)))) {
  22.                 hi--;
  23.                 continue;
  24.        }
  25.  
  26.     // swaping variables
  27.      swap(ch, lo, hi);
  28.             lo++;
  29.             hi--;
  30.       }
  31.  
  32.         return String.valueOf(ch);
  33.     }
  34.  
  35. private static void swap(char[] ch, int lo, int hi) {
  36.  
  37.         char temparray = ch[lo];
  38.         ch[lo] = ch[hi];
  39.         ch[hi] = temparray;
  40.  
  41.  }
  42.     
  43. public static void main (String args[]) {
  44.         
  45.          
  46.  System.out.println("After reversing vowels in a string="reverseVowels("InstanceOfjava"));
  47.         
  48.          
  49. }
  50.  
  51. }
Output:


  1. After reversing vowels in a string=anstancOefjavI


Core java online programming test on inheritance

  • Inheritance means getting properties from one class object to another.
  • So in sub class we can use or access super class variables and method : re usability
  • There are some interesting and important points to discuss about inheritance
  • In major java interviews and java online test on core java there is more chance of getting programming questions from inheritance
  • So let us see some java test questions. java test online to practice
  • If you want explanations then visit below topic
  • Top 16 Java Inheritance Interview questions for freshers and experienced  




5 Points to know about inheritance:

Program #1: Java test on inheritance:
  • Creating object for super class and calling super class methods and accessing super class variables.

  1. package interviewprograms.instanceofjava;
  2. public class Super{
  3.  
  4.  int a, int b;
  5.  
  6. void show(){
  7.  System.out,println("Inside Show method");
  8. }
  9.  
  10. }



  1. package interviewprograms.instanceofjava;
  2. public class Sub extends Super{
  3.  int a, int b;
  4. public static void main(String[] args) {
  5.         
  6. Super obj= new Super();
  7. obj.a=10;
  8. System.out,println(obj.a);
  9.  obj.show();
  10. }
  11. }






Program #2: Core Java online test on inheritance:
  • Creating object for sub class and calling sub class methods and accessing sub class variables.

  1. package interviewprograms.instanceofjava;
  2. public class Super{
  3.  
  4.  int a, int b;
  5.  
  6. void show(){
  7.  System.out,println("Inside Show method");
  8. }
  9.  
  10. }

  1. package interviewprograms.instanceofjava;
  2.  
  3. public class Sub extends Super{
  4.  int x;
  5.  
  6.  
  7. void show(){
  8.  System.out,println("Inside Sub class Show method");
  9. }
  10. public static void main(String[] args) {
  11.         
  12. Sub obj= new Sub ();
  13. obj.x=10;
  14. System.out,println(obj.x);
  15.  obj.show();
  16. }
  17. }





Program #3: core java online test for beginners and experienced on inheritance
  • Creating object for sub class accessing super class members and sub class members.

  1. package interviewprograms.instanceofjava;
  2. public class Super{
  3.  
  4.  int a, int b;
  5.  
  6. void show(){
  7.  System.out,println("Inside Show method");
  8. }
  9.  
  10. void print(){
  11.  System.out,println("Inside super class print method");
  12. }
  13.  
  14. }

  1. package interviewprograms.instanceofjava;
  2.  
  3. public class Sub extends Super{
  4.  int x;
  5.  
  6.  
  7. void show(){
  8.  System.out,println("Inside Sub class Show method");
  9. }
  10. void msg(){
  11.  System.out,println("Inside Sub class msg method");
  12. }
  13. public static void main(String[] args) {
  14.         
  15. Sub obj= new Sub ();
  16. obj.x=10;
  17. System.out,println(obj.x);
  18.  obj.show();
  19. obj.print();
  20. }
  21. }







Program #4: core java online test for beginners and experienced on inheritance
  • Creating object for sub class and assigning to super class reference.

  1. package interviewprograms.instanceofjava;
  2. public class Super{
  3.  
  4.  int a, int b;
  5.  
  6. void show(){
  7.  System.out,println("Inside Show method");
  8. }
  9.  
  10. void print(){
  11.  System.out,println("Inside super class print method");
  12. }
  13.  
  14. }


core java online test for beginners






Program #5: core java online test for beginners and experienced on inheritance

  • Creating object for sub class and assigning to super class reference and calling sub class method.
  1. package interviewprograms.instanceofjava;
  2. public class Super{
  3.  
  4.  int a, int b;
  5.  
  6. void show(){
  7.  System.out,println("Inside Show method");
  8. }
  9.  
  10. void print(){
  11.  System.out,println("Inside super class print method");
  12. }
  13.  
  14. }


  1. package interviewprograms.instanceofjava;
  2.  
  3. public class Sub extends Super{
  4.  int x;
  5.  
  6.  
  7. void show(){
  8.  System.out,println("Inside Sub class Show method");
  9. }
  10.  
  11. void msg(){
  12.  System.out,println("Inside Sub class msg method");
  13.  
  14. public static void main(String[] args) {
  15.         
  16. Super obj= new Sub (); 
  17. obj.msg();
  18. }
  19. }





EnJoY LeArNinG  WitH Us...

Java interview questions to practice

  • We have provided some java interview programming questions for freshers and experienced candidates.
  • So please try to answer these java interview questions and practice.
  • If you have any doubt go through the given explanation link you can get the answer for that.
  • Still if  you need any clarifications feel free to contact us. Skype/Gmail: instanceofjava




Program #1: what will happen if we try to interchange modifiers of main method

  1. package interviewprograms.instanceofjava;
  2. public class InterviewProgram {
  3.  
  4. /**
  5. * @java interview programming  questions and answers for freshers and experienced
  6.  */
  7.   
  8. static public void main(String[] args) {
  9.         
  10.         System.out.println("Hello world");
  11.  
  12.     }
  13. }





Program #2:Do you know about static in java . How static works?


java interview questions for experienced candidates





Program #3:Java Interview question on try catch block in java

  1. package interviewprograms.instanceofjava;
  2. public class InterviewProgram {
  3.  
  4. /**
  5. * @java interview programming  questions and answers for freshers and experienced
  6.  */
  7.   
  8. public static void main(String[] args) {
  9.         
  10.  try {
  11.  
  12.             System.out.println("I am try block");
  13.             
  14. } finally {
  15.  
  16.             System.out.println("I am finally block");        }
  17.  
  18. }
  19. }







Program #4:Java Interview question on what happens when we print object
  1. package interviewprograms.instanceofjava;
  2. public class InterviewProgram {
  3.  
  4. /**
  5. * @java interview programming  questions and answers for freshers and experienced
  6.  */
  7.   
  8. public static void main(String[] args) {
  9.         
  10.  try {
  11.  
  12.             System.out.println("I am try block");
  13.             
  14. } finally {
  15.  
  16.             System.out.println("I am finally block");        }
  17.  
  18. }
  19. }





Java programming interview questions and answers for experienced

  • Here some of the java programming interview questions and answers for experienced on different topics.
  • Java interview programs and answers for experienced.
  • Java Coding interview Questions
  • Java tricky interview programs to practice.




 Program #1: what will happen if we try to print null using system.out.println

  1. package interviewprograms.instanceofjava;
  2. public class InterviewProgram {
  3.  
  4.     /**
  5.      * @java programming interview questions and answers for freshers and experienced
  6.      */
  7.     public static void main(String[] args) {
  8.         
  9.         System.out.println(null);
  10.  
  11.     }
  12.  
  13. }






Program #2: Java Interview program :Can we create object for abstract class in same class

  1. package interviewprograms.instanceofjava;
  2. public abstract class AbstractDemo {
  3.  
  4. public static void main(String args[]){
  5.         
  6.         AbstractDemo obj = new AbstractDemo();
  7.         
  8.  }
  9.  
  10. }





Program #3: Java Interview program : what will be the output of below java program


Java programming interview questions and answers for experienced





 Program #4: Guess the order of execution of constructors

  1. package interviewprograms.instanceofjava;
  2. public class ConstructorDemo {
  3.  
  4. ConstructorDemo(){
  5.         this(1);
  6.         System.out.println("Zero argument constructor");
  7. }
  8.     
  9. ConstructorDemo(int a){
  10.         this("Hi",1);
  11.         System.out.println("One argument constructor");
  12. }
  13.  
  14. ConstructorDemo(String str, int x){
  15.     
  16.         System.out.println("Two argument constructor");
  17. }
  18.  
  19. public static void main(String[] args) {
  20.  
  21.         ConstructorDemo obj =new ConstructorDemo();
  22.  
  23.     }
  24.  
  25. }





Super keyword java programs for interview for freshers and experienced

  • Lets see some interesting java programs on super keyword.
  • Basically super keyword used to refer super class methods and variables. So now let us see how super will work in some scenarios. lets practice.
  • Try to answer below java programming interview questions for beginners. 
  • Java programs asked in technical interview for freshers and experienced.




Program #1: What will be the output of below java program

  1. package com.superkeywordinjava;
  2.  public Class SuperDemo{ 
  3.  
  4. int a,b;
  5.  
  6. }

  1. package com.superkeywordinjava;
  2. public Class Subdemo extends SuperDemo{ 
  3. int a,b;
  4. void disply(){

  5. super.a=10;
  6. super.b=20;
  7.  
  8. System.out.println(a);
  9. System.out.println(b);
  10. System.out.println(super.a);
  11. System.out.println(super.b);
  12.  
  13. }
  14.  
  15. public static void main (String args[]) {
  16.  Subdemo obj= new Subdemo();
  17.  
  18. obj.a=1;
  19. obj.b=2;
  20.  
  21. obj.disply();
  22.  

  23.  
  24. }
  25. }






Program #2: What will be the output of below java program


super keyword java interview programs for freshers





Program #3: Basic java programs for interview on super keyword

  1. package com.superinterviewprograms;
  2. public Class SuperDemo{ 
  3.  
  4. int a,b;
  5.  
  6. SuperDemo(int x, int y){
  7.  a=x;
  8. b=y
  9. System.out.println("Super class constructor called ");
  10.  
  11.  
  12. }

  1. package com.superinterviewprograms;
  2.  
  3. public Class Subdemo extends SuperDemo{ 
  4.  
  5. int a,b;
  6.  
  7. SubDemo(int x, int y){
  8. super(10,20);
  9.  a=x;
  10. b=y
  11. System.out.println("Sub class constructor called ");
  12. }
  13.  
  14. public static void main (String args[]) {
  15.  Subdemo obj= new Subdemo(1,2);

  16.  
  17. }
  18. }





Program #4: Java interview Program on super keyword

  • What will happen if our class constructor having super() call but our class not extending any class.

  1. package com.superinterviewprograms;
  2.  
  3. public Class Sample{ 
  4.  
  5. Sample(){
  6. super();
  7. System.out.println("Sample class constructor called "); 
  8.  
  9. }
  10.  
  11. public static void main (String args[]) {
  12.  
  13.  Sample obj= new Sample();
  14.  
  15. }
  16. }





How to watch online movies with subtitles in english for free without downloading

  • Now we are going to see how to play online streaming videos with English subtitles or your language subtitles.
  • Whenever we want to see some movie we will search it on search engine like google and will choose one site then will play the movie but we wont find sub titles for it then we will shift to another site for online streaming.
  • Then we will download the movie and add the subtitles to the player.
  • So instead of downloading and adding. we need to add subtitles online itself.
  • Now we will see  how to add subtitles to online streaming movie 
  • Now watch movies with English subtitles.



How to add subtitles to online streaming movie:

  •  We need to add add on to our browser . if you are using Firefox:
  • Then add : Online subtitles 1.0.1 to your Firefox.
  • Provide an easy way of adding subtitles to online videos.With this addon users can add subtitles to online videos. In this way downloading the video for subtitling is avoided.
    To add subtitles:
    1. You must first copy the contents of the .srt file to the clipboard.
    2. Right click a video.
    3. Click on the menu: Paste subtitles from clipboard.

Step #1: add Online subtitles 1.0.1 to your Firefox.


watch movies with english subtitles online streaming



 Step #2: download the .srt file of the movie 

  • After adding firefox extension download .srt file of the movie
  • And open with notepad and copy.
Step #3: open online video and right and add subtitles

  • Now right click on the movie and select paste subtitles from clipboard. 
  • Enjoy watching online movies with English, french .... subtitles
  • Watch English movies online for free without downloading
  • Watch Hollywood movies with subtitles watch Hindi movies with English subtitles.
  • watch Hollywood horror movies online free without downloading with subtitles 
  • watch korean movies with english subtitles
watch hollywood movies with english subtitles online

Private constructor in java example


Constructor in java:

  • Constructor is used to initialize class variables.
  • Constructor will be executed once per object and whenever object is created constructor will be called.




Private Constructor in java:

  • We can make constructor private, public , protected and default.
  • If we define a constructor as private means we are restricting a class to create object  outside of the class.
  • A class having private constructor does not allow user to create object outside.
  • In singleton Design pattern we will use private constructor to restrict object creation


  1. package inheritanceInterviewPrograms;
  2.  
  3. public class A {
  4.   
  5.   private A(){
  6.        
  7.        
  8.    }
  9.  
  10. public static void main(String args[]){ 
  11.    
  12.       A s= new A();
  13.   }
  14.  
  15. }

  1. package inheritanceInterviewPrograms;
  2. //  www.instanceofjava.com
  3.  
  4. public class B {
  5.     
  6. public static void main(String [] args){
  7.      
  8.     A obj= new A();// Compile time error
  9.    
  10.  
  11. }
  12. }


private Constructor example

Super keyword in java inheritance example

  • By using super keyword we can access super class variables and super class methods in sub class.
  • "Super" always refers to super class object.
  • One more interesting point about super is we can call super call constructors from sub class constructor using super keyword.
  • By default in sub class constructor super() call will be added by jvm.
  • We can also explicitly mention super call but rule is super() call must be first statement of the sub class constructor.
  • Let us see how sub class constructor calls super class constructors automatically. 


Java example program to demonstrate super call execution from sub class constructor to super class constructor 


  1. package com.superkeywordinjava;
  2.  public Class SuperDemo{ 
  3.  
  4. SuperDemo(){
  5. System.out.println("Inside super class constructor");
  6. }
  7.  
  8. }

  1. package com.superkeywordinjava;
  2. public Class Subdemo extends SuperDemo{ 
  3.  
  4. Subdemo(){
  5. System.out.println("Inside sub class constructor");
  6. }
  7.  
  8. public static void main (String args[]) {
  9.  Subdemo obj= new Subdemo();
  10.  
  11.  
  12. }
  13. }

Output:

  1. Inside super class constructor
  2. Inside sub class constructor


  • In the above programs whenever we are creating object of the sub class corresponding sub class constructor will be executed 
  • By default in sub class constructor super(); call will be added so now it will call super class zero argument constructor.

  1. Subdemo(){
  2. super(); // will be added automatically
  3. System.out.println("Inside sub class constructor");
  4. }

  • Whenever there is no constructor in sub class then default constructor added automatically and that contains super call in it.
  • And also when ever we define a constructor in our class .By default super(); call will be added automatically as first statement.
Java example program to demonstrate super call execution from sub class constructor to super class constructor by placing super call explicitly.


  1. package com.superkeywordinjava;
  2.  public Class SuperDemo{ 
  3.  
  4. SuperDemo(){
  5. System.out.println("Inside super class constructor");
  6. }
  7.  
  8. }

  1. package com.superkeywordinjava;
  2. public Class Subdemo extends SuperDemo{ 
  3.  
  4. Subdemo(){
  5. super();
  6. System.out.println("Inside sub class constructor");
  7. }
  8.  
  9. public static void main (String args[]) {
  10.  Subdemo obj= new Subdemo();
  11.  
  12.  
  13. }
  14. }

Output:

  1. Inside super class constructor
  2. Inside sub class constructor

  • Super call must be first statement inside the sub class constructor otherwise compile time error will come.
super keyword in java inheritance


  • If super class having parameterized constructor it is mandatory to call super class constructor explicitly by passing required parameters.
  • other wise compile time error will come

super in inheritance in java



  1. Sub(){
  2. super(1,2); // will work fine
  3. System.out.println("Inside sub class constructor");
  4. }

Java programming interview questions on this keyword part 3



Java Quiz on this keyword part #3

Program #9: Is it possible to Pass this as parameter of a method?

  1. package thiskeywordinterviewprograms.java;
  2.  
  3. public class ThisDemo {
  4.     int a,b;
  5.     
  6. public ThisDemo Show(){
  7.         
  8.   this.a=10;
  9.   this.b=20;
  10.   return this;
  11. }
  12.  
  13. public static void main(String[] args) {
  14.         
  15.     ThisDemo obj = new ThisDemo();
  16.         
  17.   System.out.println("a="+obj.a);
  18.   System.out.println("b="+obj.b);
  19.   ThisDemo obj1 = obj.Show();
  20.         
  21.   System.out.println("a="+obj1.a);
  22.   System.out.println("b="+obj1.b);
  23.         
  24. }
  25.  
  26. }






Program #10: Is is possible to access static variables and static methods using this keyword?

java programming this keyword





Program #11:Java program to test whether we can use this in static block or not?


  1. package thiskeywordinterviewprograms.java;
  2. public class ThisDemo {
  3.  
  4.   static int a,b;
  5.     
  6. static{
  7.     
  8.     this.a=10;
  9.     this.b=20;
  10. }
  11.  
  12. public static void main(String[] args) {
  13.         
  14.   ThisDemo obj = new ThisDemo();
  15.         
  16.   System.out.println("a="+obj.a);
  17.   System.out.println("b="+obj.b);
  18.       
  19.   
  20. }
  21.  
  22. }





Program #12: Java interview program to test whether we can use this in static methods?


  1. package thiskeywordinterviewprograms.java;
  2. public class ThisDemo {
  3.  
  4.     static int a,b;
  5.    
  6.  
  7. public static void main(String[] args) {
  8.  

  9.   ThisDemo obj = new ThisDemo();
  10.    this.a=10;
  11.    this.b=20;    
  12.   System.out.println("a="+obj.a);
  13.   System.out.println("b="+obj.b);
  14.       
  15.     
  16. }
  17.  
  18. }







Select Menu