Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8593901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:05:30+00:00 2026-06-12T00:05:30+00:00

I have created the class like below. But Override method is not called. Is

  • 0

I have created the class like below. But Override method is not called. Is anything I missed? Otherwise i need to add any key word(like Virtual) to use as Override?

MyWebView.java

package com.example.stackoverflow;    

import android.content.Context;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.LinearLayout;

public class MyWebView extends WebView 
{
    WebView localView;
    static Context localcontext;
    A aclass;

    public MyWebView(Context context)
    {
        super(context);     
        localcontext=context;
    }

    public LinearLayout init()
    {
        LinearLayout layout=new LinearLayout(localcontext);
        localView=new WebView(localcontext);
        localView.setWebViewClient(new MyClient());
        aclass=new A();
        layout.addView(localView);
        return layout;
    }

    class MyClient extends WebViewClient
    {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            aclass.startMyMethod();
            return super.shouldOverrideUrlLoading(view, url);
        }
    }

}

A.java

package com.example.stackoverflow;

import android.os.Bundle;
import android.widget.LinearLayout;
import android.app.Activity;

public class A extends Activity 
{

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        MyWebView view=new MyWebView(this);
        LinearLayout layout = view.init();
        view.loadUrl("https://www.google.co.in/");
        setContentView(layout);
     }

    public void startMyMethod() 
    {       
        System.out.println("ParentMethod");
    }
}

B.java(MainActivity)

package com.example.stackoverflow;

import android.os.Bundle;

public class B extends A {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
     }

    @Override
    public void startMyMethod() {
        System.out.println("ChildMethod");
        super.startMyMethod();
    }

}

Note: class B is client side class. others two in jar file. how can i
use new B() inside jar file(library source). name B may be changed. If parent method is overridden, then parent content should not be executed

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T00:05:31+00:00Added an answer on June 12, 2026 at 12:05 am

    Java does not have any keyword like virtual, by default all java non-static methods are virtual. See http://en.wikipedia.org/wiki/Virtual_function#Java.

    @Override annotation is used to instruct compiler that you are overriding super class method. See here

    A a =new A();
    a.startMyMethod(); // calls A.startMyMethod()
    
    A b = new B(); // Object reference of type A and Object of B
    a.startMyMethod(); // calls B.startMyMethod()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm learning EF4.1 against the northwind database. I have created a POCO class like
I have created a dictionary in Class A and would like to return the
I have created my own Attached Property like this: public static class LabelExtension {
Say I have a structure like: class SomeObject Public Name as String Public Created
I have an instance of the Popen class created through subprocess.Popen. I would like
I have a db that is created like this... public class DataBaseManager extends SQLiteOpenHelper{
I would like to create a thread pool. I have a class called ServerThread.cpp,
I have created a class called Class1, and in another module, I want to
I have created a class doing some jobs like GridView inherit from System.Web.UI.WebControls.WebControl. public
I am following the guide at http://guides.rubyonrails.org/association_basics.html and I have created class Customer <

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.