java


Dynamic binding can show protected methods?


parent class
package PPRO.Custom.Integration;
public class eInvoice_BSSFormat {
protected void run(String[] param){
}
}
other class
package PPRO.Custom.Integration;
public class eInvoice_Archon extends eInvoice_BSSFormat{
}
another one class
package com.birchstreet.smwc.scheduler.jobs;
public class eInvoice_Archon extends PPRO.Custom.Integration.eInvoice_Archon implements Job {
#Override
public void execute(JobExecutionContext arg0) throws JobExecutionException {
PPRO.Custom.Integration.eInvoice_Archon arc = new eInvoice_Archon();
arc.run(args);
}
eclipse show the problem is
The method run(String[]) from the type eInvoice_BSSFormat is not
visible
we can not changes the existing file only work in new file and we can not use this class object use
when we use like this problem solved
eInvoice_Archon arc = new eInvoice_Archon();
but we can not use like this only parent reference variable
how to solve this problem
From JLS 6.6.2. Details on protected Access
A protected member or constructor of an object may be accessed from outside the package in which it is declared only by code that is responsible for the implementation of that object.
Your protected void run(String[] param) method is protected so you can only access it within same package or from any class which implements you eInvoice_BSSFormat.
Use following:
package com.birchstreet.smwc.scheduler.jobs;
public class eInvoice_Archon extends PPRO.Custom.Integration.eInvoice_Archon implements Job {
#Override
public void execute(JobExecutionContext arg0) throws JobExecutionException {
//PPRO.Custom.Integration.eInvoice_Archon arc = new eInvoice_Archon();
this.run(args);
}
}
run() method is protected so you can only use it in a subclass in a different package
package A;
class Parent{
protected int x = 45;
}
package B;
import A.*;
class Child extends Parent{
public void access(){
x= 100; // works
}
public void method(){
Parent p =new Parent();
p.x = 150; // error
}
}

Related Links

Hibernate - Errors while querying, “loop” of exceptions
Why JOptionPane cannot stop flow of execution, in my application?
How to retain session after java web server redeployed or crashed
Hibernate does not refresh entity childs completely
Android: How to make EditText digital input string into int?
How to set priorities for multiple threads in java [duplicate]
SimpleDateFormat gives API Error
NoSuchBeanDefinitionException in DelegatingFilterProxy
NullPointerException when using String from SQL database
Parsing Multiple Lines As Object Before Creating Tuple For Apache PIG UDF
How to return deep nested projections in Spring data rest?
How can I make this Variable by UserInput work? android
Material SearchBar Not Appearing
Implementing onClick in the Recyclerview Adapter
How do you extract numbers from an input file and use them for any output you want?
JavaFx Spreadsheet Cell Right Click Open Dialog

Categories

HOME
appx
hashmap
lodash
spagobi
cvs
tizen-web-app
win32gui
fsm
ckeditor
baqend
wamp
cloudkit
tomcat6
mapserver
collectd
usergrid
ups
progressive-web-apps
autocad-plugin
xpages-ssjs
tdd
cas
su
fgetcsv
elasticsearch-ruby
msys2
quote
nouislider
google-rich-snippets
javascriptcore
iframe-resizer
twilio-api
uisplitview
xmlreader
accelerate-framework
gammu
geopositioning
atl
y86
mmenu
lumberjack
quadratic-programming
http-live-streaming
arena-simulation
websphere-mq-fte
flickr-api
appcompat
hibernate-tools
react-scripts
tizen-native-app
worker-thread
diagnostics
libusb-win32
font-size
minimization
blacklist
pintos
cubes
nested-sets
grails-tomcat-plugin
plottable.js
player
firebaseui
fputcsv
lua-5.1
goose
revolution-r
wapiti
rtbkit
vhd
thredds
libressl
iis-arr
map-projections
sankey-diagram
csquery
oxwall
castle
typeof
tld
poller
terminal-services
xsockets.net
odata4j
dmoz
jquery-knob
dotnethighcharts
assembly-loading
gnustep
psi
cinema-4d
floating
remember-me
visitor-statistic
site.master
h.323
getresponsestream
bespin
iweb
adrotator
uimenucontroller
anti-piracy
django-notification
windows-live-messenger

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App