HELP PLEASE WITH THIS QUESTION....INTERVIEW TODAY
In an existing application, the code to implement a particular feature is encapsulated in a single class. However the requirements have just changed and this feature must exhibit an alternative behaviour in some instances, while continuing to exhibit the existing behaviour in other instances. Discuss support in Java for implementing the new requirement.
Thanks for the replies, guys.
It is not as if I can not answer it but this is a
forum and this is a chance for me to get a job. I am
trying to be sure of the right explanation. OK, fair enough.
What I
feel initially is that an abstract class or an
interface will be needed if you want to change the
implementation later i.e. overriding the methods.That's true, if you want to be sure that client code using your class doesn't change they'll want be making the call through an interface or abstract class.
You can inherit and override even if you don't have an interface or abstract class, but in that case polymorphism can't help you and you force clients to change their code. Worse, they have to start checking for instance type.
So yes, you'll have three steps:
(1) Write the common interface that has the signature of the method you'd like to override.
(2) Have the original class implement the interface.
(3) Write the new class such that it implements the interface and uses its new functionality.
If the original class implementation can be considered "default", you can go for an abstract class that implements the interface and provides the default implementation. I'd have both the original and new classes extend the abstract class in that case.
%
Similar Messages
-
Please help me with this questions "if I purchased items through mac or windows is it possible to re-download those purchases on Apple TV though iCloud"
It depends on what country you're in and whether or not they're still available in the iTunes Store. Some purchased movies and all rentals won't be available.
(108225) -
Would one of you kind people be able to help me with this. I am almost tearing my hair out.
This is what i want...
a small form (table) that states this..
Description:
Browse:
Upload evidence:
In the description, a small little box so that a user can enter a small note.
In the browse box, i would like it to go to C:\Program Files\Microsoft Games\Age of Empires II\Screenshots
and finally, the upload evidence to be uploaded to a part on a ftp server... example /var/www/folder1/folder2
any help would be amazing!!!!! Thankyou very much> even if it is just some kind of HTML code will do.
Just so i can paste the code in a .txt and save as
html, and make minor changes to it will do.
thanks
If you're looking for someone to write this for you, go here: http://www.rentacoder.com
If you have a specific, Java-related question about some code you wrote, ask it here. -
Please help me with this question..
Hi everyone,
Sorry for asking the same question which was posted many times in this forum.
I have the following scenario..
Database name: database1
schema names: schema1
schema2
schema3
schema4
schema5
schema6
schema7
workspace is with: schema1
schema2
1. can i create 1 application that need to access tables in both schema1 and schema2 ?
comments: I think we have to choose "parsing schema" when i am creating an application.
if i choose the parsing schema as "schema1".
2.how can i create a "form on a table" or some other wizard based forms which is in schema2?
3.what priviliges do i need to create "form on a table" or some other wizard based forms which is in schema2?
4.As my workspace is with schema1 and schema2. How can i create "forms" on tables which are in
schema3? do i need to "create a view of table in schema3" in schema1?
All the above question will raise if i have to create forms or reports with "wizards". Is this stmt correct?
I mean if i create a form "manually" all i need to look whether i have insert,update and delete priv on
that object? is it correct?i think this question was answered several times.sorry for the repost.
ThanksIt is not necessary to say "please help me" since help comes almost always. Maybe sometimes you need to bump your question after a while. However, back to your question. I can tell you how I solve that problem:
granting select, insert, update, delete on all tables to the parsing schema
granting select on all views to the parsing schema
granting execute on all procedures and packages to the parsing schema
creating synonyms in the parsing schema for all tables, views, sequences, etc.
You can do all of this programatically in a loop instead of writing it for each object separatelly.
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://apex.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------------------ -
Please help me with this question ftp
please help me to continue i don't know how to finished
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
public class myftp2 {
static String host = null;
static String path = "/";
public static void main(String[] args) {
if(args.length != 1) {
usage();
System.exit(1);
host = "ftp://"+args[0];
if( ! isOpen() )
System.out.println("Cannot connect to "+host+path);
System.exit(1);
System.out.println("Connected to "+host+path);
BufferedReader kb = new BufferedReader( new InputStreamReader(System.in));
boolean finished = false;
while( ! finished ) {
String input;
String[] cmdArgs;
System.out.print("myftp> ");
try {
input = kb.readLine();
cmdArgs = input.split("
s");
if(cmdArgs[0].equals("exit") ) {
finished = true;
else if( cmdArgs[0].equals("dir")) {
dirCommand();
else if (cmdArgs[0].equals("get"))
else if( cmdArgs[0].equals("pwd")) {
System.out.println(host+path);
else if( cmdArgs[0].equals("cd")) {
if(cmdArgs.length!= 2) {
System.out.println("You must include the directory name");
else
cdCommand(cmdArgs[1]);
else if (cmdArgs[0].equals("cd.."))
//cdCommand(cmdArgs[1]);
catch(IOException e){
System.out.println("Goodbye");
static void usage() {
System.out.println("Usage: java myftp <hostname>");
System.out.println("please write your username:password@<hostname>");
static boolean isOpen() {
try {
URL url = new URL(host+path);
InputStream in = url.openStream();
in.close();
catch(IOException e) {
System.out.println(e.getMessage());
return false;
return true;
static void dirCommand() {
String line;
try {
URL url = new URL(host+path);
InputStream in = url.openStream();
InputStreamReader inStr = new InputStreamReader(in);
BufferedReader inNet = new BufferedReader(inStr);
while((line = inNet.readLine()) != null)
System.out.println(line);
catch(IOException e) {
System.out.println("Error: cant list the directory");
static void cdCommand(String directory) {
static void cdCommandback(String dir)
}Please stop crossposting this question.
http://forum.java.sun.com/thread.jspa?threadID=5253698&messageID=10050532#10050532 -
Help me with this question?
Hello everyone,
I am doing a university assignment on oracle. The question i have is not really technical, but more theory based.
The question that is asked is this:
== begin ==
Produce a description of the elements of the sales, marketing and stock control departments that you would envisage would be responsible for the running of the order entry and stock control system.
It is important taht you outline job responsibilities in relation to the database. A diagram showing these would be useful
== end ==
I'm really not sure what i means by "elements of" [each department].
Can anyone help me out, by just suggesting what this may mean?
Thanks!
Gary.They mean, which bits of the company are involved in
the process. They're are being vague because they
want you to think about the whole system - things as
well as people.
Cheers, APCThanks for your help, i'll have a good think about it :-) -
Help me with this question about restoring my iphone
When i went into the apple store the guy was going to restore my iphone to factory settings but i wanted to back it up first so i went home to do it myself and after i restored it everything was still there which should of been deleted (example: like my apps and notes) what did i do wrong? how do i restore my iphone correctly? please help
Message was edited by: wwwwwwwww
how do you restore the iphone to factory settings as a new device.If you don't want all the stuff that was on before, then you need to restore it as a new device. What you did was to restore your backup with everything you did not want.
-
Can anyone help me with this question?
hi experts
Now I am writing a report and I have to get the number of how many pages is going to be displayed.
How can I know this? I know there is a system variantsy-pagnocontains the current page number, but is there any variant that can tell me how many pages are there?
many thanks...REPORT Y_WA no standard page heading line-count 60(5).
data: v_totpage type i.
data: v_temp(3) type c.
Start-of-selection.
do 100 times.
write:/ sy-index.
enddo.
end-of-selection.
v_temp = v_totpage.
do v_totpage times.
read line 1 of page sy-index.
replace '@@@' in sy-lisel with v_temp.
modify line 1 of page sy-index.
enddo.
top-of-page.
write:/60 'page', sy-pagno, '/','@@@'.
v_totpage = sy-pagno.
Here is a sample:
zlines number of lines in the table
sy-srows number of lines in screen
sy-cpage current page
zpages total number of pages type i
temp temporary number type f
describe table itab lines zlines.
temp = zlines / sy-srows.
zpages = trunc( temp ).
temp = frac( temp ).
if temp > 0.
zpages = zpages + 1.
endif.
zpages is the number of pages
write: /'Page ',sy-cpage, ' of ', zpages. -
Little help please with forwarding traffic to proxy server!
hi all, little help please with this error message
i got this when i ran my code and requested only the home page of the google at my client side !!
GET / HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*
Accept-Language: en-us
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.2; .NET CLR 2.0.50727)
Host: www.google.com
Connection: Keep-Alive
Cookie: PREF=ID=a21457942a93fc67:TB=2:TM=1212883502:LM=1213187620:GM=1:S=H1BYeDQt9622ONKF
HTTP/1.0 200 OK
Cache-Control: private, max-age=0
Date: Fri, 20 Jun 2008 22:43:15 GMT
Expires: -1
Content-Type: text/html; charset=UTF-8
Content-Encoding: gzip
Server: gws
Content-Length: 2649
X-Cache: MISS from linux-e6p8
X-Cache-Lookup: MISS from linux-e6p8:3128
Via: 1.0
Connection: keep-alive
GET /8SE/11?MI=32d919696b43409cb90ec369fe7aab75&LV=3.1.0.146&AG=T14050&IS=0000&TE=1&TV=tmen-us%7Cts20080620224324%7Crf0%7Csq38%7Cwi133526%7Ceuhttp%3A%2F%2Fwww.google.com%2F HTTP/1.1
User-Agent: MSN_SL/3.1 Microsoft-Windows/5.1
Host: g.ceipmsn.com
HTTP/1.0 403 Forbidden
Server: squid/2.6.STABLE5
Date: Sat, 21 Jun 2008 01:46:26 GMT
Content-Type: text/html
Content-Length: 1066
Expires: Sat, 21 Jun 2008 01:46:26 GMT
X-Squid-Error: ERR_ACCESS_DENIED 0
X-Cache: MISS from linux-e6p8
X-Cache-Lookup: NONE from linux-e6p8:3128
Via: 1.0
Connection: close
java.net.SocketException: Broken pipe // this is the error message
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:115)
at java.io.DataOutputStream.writeBytes(DataOutputStream.java:259)
at SimpleHttpHandler.run(Test77.java:61)
at java.lang.Thread.run(Thread.java:595)
at Test77.main(Test77.java:13)please could just tell me what is wrong with my code ! this is the last idea in my G.p and am havin difficulties with that cuz this is the first time dealin with java :( the purpose of my code to forward the http traffic from client to Squid server ( proxy server ) then forward the response from squid server to the clients !
thanx a lot,
this is my code :
import java.io.*;
import java.net.*;
public class Test7 {
public static void main(String[] args) {
try {
ServerSocket serverSocket = new ServerSocket(1416);
while(true){
System.out.println("Waiting for request");
Socket socket = serverSocket.accept();
new Thread(new SimpleHttpHandler(socket)).run();
socket.close();
catch (Exception e) {
e.printStackTrace();
class SimpleHttpHandler implements Runnable{
private final static String CLRF = "\r\n";
private Socket client;
private DataOutputStream writer;
private DataOutputStream writer2;
private BufferedReader reader;
private BufferedReader reader2;
public SimpleHttpHandler(Socket client){
this.client = client;
public void run(){
try{
this.reader = new BufferedReader(
new InputStreamReader(
this.client.getInputStream()
InetAddress ipp=InetAddress.getByName("192.168.6.29"); \\ my squid server
System.out.println(ipp);
StringBuffer buffer = new StringBuffer();
Socket ss=new Socket(ipp,3128);
this.writer= new DataOutputStream(ss.getOutputStream());
writer.writeBytes(this.read());
this.reader2 = new BufferedReader(
new InputStreamReader(
ss.getInputStream()
this.writer2= new DataOutputStream(this.client.getOutputStream());
writer2.writeBytes(this.read2());
this.writer2.close();
this.writer.close();
this.reader.close();
this.reader2.close();
this.client.close();
catch(Exception e){
e.printStackTrace();
private String read() throws IOException{
String in = "";
StringBuffer buffer = new StringBuffer();
while(!(in = this.reader.readLine()).trim().equals("")){
buffer.append(in + "\n");
buffer.append(in + "\n");
System.out.println(buffer.toString());
return buffer.toString();
private String read2() throws IOException{
String in = "";
StringBuffer buffer = new StringBuffer();
while(!(in = this.reader2.readLine()).trim().equals("")){
buffer.append(in + "\n");
System.out.println(buffer.toString());
return buffer.toString();
Edited by: Tareq85 on Jun 20, 2008 5:22 PM -
I would like to create a view on this table with four columns
1. PN#_EXP_DATE
2. PN#
3. PN#_EFF_DATE
4. PN#
P_S_C A_C P EXP_DT
21698 13921 1 5/29/2009 3:15:41 PM
21698 13921 1 5/29/2009 3:54:57 PM
21698 1716656 4 5/29/2009 3:15:41 PM
21698 3217 3 5/29/2009 3:15:40 PM
21698 3217 3 5/29/2009 3:54:57 PM
21698 60559 2 5/29/2009 3:15:41 PM
21698 60559 2 5/29/2009 3:54:57 PM
I have a trigger on A, which inserts the DML records into B. (Table A and B structure is the almost the same,
where table B will have one extra column exp_dt)
NOw Table B can have records with same P_S_C and A_C columns and exp_dt will capture the history.
for example: from the above sample data, let us take first two records..
P_S_C A_C P EXP_DT
21698 13921 1 5/29/2009 3:15:41 PM --- Record 1
21698 13921 1 5/29/2009 3:54:57 PM --- Record 2
from this..
Note: 1. Table A and Table C can be joined using A.P_S_C and C.R_C to get the start_date.
2. PN# comes from table D. It contains numbers for the resp. weeks.
3. PN#_EFF_DATE is the previous immediate previous date for that record in history table (Table B).
I wanted the data like..
---- this is for the second record in the above..
PN#_EXP_DATE PN# PN#_EFF_DATE PN#
5/29/2009 3:54:57 PM 214 5/29/2009 3:15:41 PM 214
---- this is for the first record in the above..
PN#_EXP_DATE PN# PN#_EFF_DATE PN#
5/29/2009 3:54:41 PM 214 ( for this we should query the table C to get the
start_date, for this combinatation of P_S_C and A_C in table B
where B.P_S_C = C.A_C
and that value should be the EFF_DT for this record)
Please help me with this....
Thanks in advance..Hi All,
select d.P# as "PN#_EXP_DATE", exp_date
from daily_prd d, cbs1_assoc_hist b
where to_char(d.day_date,'MM/DD/YYYY') = to_char(b.exp_date,'MM/DD/YYYY')
and d.period_type = 'TIMEREPORT';
This above query gives the output as follows:
pn#_exp_date exp_date
214 5/29/2009 3:15:40 PM
214 5/29/2009 3:15:41 PM
214 5/29/2009 3:15:41 PM
214 5/29/2009 3:15:41 PM
214 5/29/2009 3:54:57 PM
214 5/29/2009 3:54:57 PM
214 5/29/2009 3:54:57 PM
This below is the data from history table (Table B).
P_S_C A_C PLACE EXP_DATE
21698 3217 3 5/29/2009 3:15:40 PM
21698 13921 1 5/29/2009 3:15:41 PM
21698 1716656 4 5/29/2009 3:15:41 PM
21698 60559 2 5/29/2009 3:15:41 PM
21698 13921 1 5/29/2009 3:54:57 PM
21698 3217 3 5/29/2009 3:54:57 PM
21698 60559 2 5/29/2009 3:54:57 PM
I got the pn#_exp_date from the Table 'D', for the given exp_date from Table B.
My question is again....
CASE - 1
from the given records above, I need to look for exp_date for the given same P_S_C and A_C.
in this case we can take the example...
P_S_C A_C PLACE EXP_DATE
21698 3217 3 5/29/2009 3:15:40 PM
21698 3217 3 5/29/2009 3:54:57 PM
In this case, the
pn#_exp_date exp_date pn#_eff_date eff_date
214 5/29/2009 3:15:57 PM < PN# corresponding to the 5/29/2009 3:15:40 PM
eff_date .>
<Basically the eff_date is
nothing but the exp_date only.
we should take the immediate before one.
In this case, our eff_date is '5/29/2009 3:15:40 PM'.
but how to get this.
CASE - 2
from the above sample data, consider this
P_S_C A_C PLACE EXP_DATE
21698 1716656 4 5/29/2009 3:15:41 PM
In this case, there is only one record for the P_S_C and A_C combination.
The expected result :
pn#_exp_date exp_date pn#_eff_date eff_date
214 5/29/2009 3:15:41 PM < PN# corresponding to the 5/29/2009 3:15:40 PM
eff_date .>
<Basically the eff_date is
nothing but the exp_date only.
we should take the immediate before one.
In this case to get the eff_date, we should query the Table 'C', to get the eff_date, which is START_DT column in this table.
for this join B.P_S_C and C.R_C.
Hope I am clear now..
Thanks in advance..... -
the title pretty much has my question i guess. it's my first post so i'm not sur if you'll see all of it. I'll just copy paste it anyhow.
i've bought the first season of Death Note on itunes, and i've was never able to download the 11th episode (Assault), it gives me error -50 each time I try. Can anyone please help me with this?Perhaps try the "Error -50," "-5000," "8003," "8008," or "-42023" section in the Specific Conditions and Alert Messages: (Mac OS X / Windows) section of the following document:
iTunes: Advanced iTunes Store troubleshooting -
I just bought this movie "Godzilla 2014" but it won't show in my Movie Library. I closed my Itunes and put it back on again but still won't show up. I checked my purchased list and it shows that I recently bought the movie but when I checked the itunes store it wants to buy the movie again. Please help me with this right away Apple.
Apple Store Customer Service at 1-800-676-2775 or visit online Help for more information.
To contact product and tech support: Contacting Apple for support and service - this includes
international calling numbers..
For Mac App Store: Apple - Support - Mac App Store.
For iTunes: Apple - Support - iTunes. -
"It is formatted incorrectly, or is not a format that iBooks can open". Can anyone help me with this message of a book that I purchased on iBooks, read, highlighted in the book and now I can't open it anymore. Please help!!!
Mine does the same thing occasionally, is your phone jailbroken? Sometimes it will work if you delete the book and reinstall it or put your phone into airplane mode then turn it back off.
-
I need to reinstall my operating system for 10.5 after seeing a file folder and question mark flashing on my start up screen. Can anyone help me with this?
Hello,
That means it can find the Hard Drive, or can't find the things needed for booting.
See if DU even sees it.
"Try Disk Utility
1. Insert the Mac OS X Install disc, then restart the computer while holding the C key.
2. When your computer finishes starting up from the disc, choose Disk Utility from the Installer menu at top of the screen. (In Mac OS X 10.4 or later, you must select your language first.)
*Important: Do not click Continue in the first screen of the Installer. If you do, you must restart from the disc again to access Disk Utility.*
3. Click the First Aid tab.
4. Select your Mac OS X volume.
5. Click Repair Disk, (not Repair Permissions). Disk Utility checks and repairs the disk."
http://docs.info.apple.com/article.html?artnum=106214
Then try a Safe Boot, (holding Shift key down at bootup), run Disk Utility in Applications>Utilities, then highlight your drive, click on Repair Permissions, reboot when it completes.
(Safe boot may stay on the gray radian for a long time, let it go, it's trying to repair the Hard Drive.) -
Hello, Honestly I just updated my 4s and my iPad 3 to iOS 6 and when try to press on the Music app or the iTunes app it says "cannot connect to iTunes Store" Could you please help me with this thank you so much, Charbel from Lebanon
See these previous discussions help.
App Store Updates (but only Updates)...: Apple Support Communities
Apps suddenly don't update: Apple Support Communities
Maybe you are looking for
-
Hello All, I am running DAC and came across the following error... Due to which some task are getting failed Here i have written Detailed Explanation... 2012-06-19 09:08:04.545 INFORMATICA TASK:SDE_ORAR1213_Adaptor:SDE_ORA_Stage_ARTransactionFact_Dif
-
Every time i try to sign in to the mac app store i get the message 'an unknown error has occurred"
I can sign into the iTunes store but not into the Mac App Store. I don't have this problem on my other Mac running the same Mac OS X 10.6.8.
-
I can't type in the web address in the address bar. I have to open a new tab to do it.
I just upgraded from Windows XP to Windows 7. I reinstalled firefox, added the speeddial that I liked so much, and then tried to use firefox. I can't type the web address into the address bar when I start firefox. I always have to open a new tab befo
-
How to import custom java jar/class into oracle to be used in java proc ?
Hi I would like to know how to import custom java jar/class files into oracle to be used in java stored procedure. I am developing a oracle pl/sql procedure to call java program. The java program will be created as procedure and will be published. Bu
-
What is process for payment run
Hi guru, Can any one tell what is process for Payment by F110. Point will reward. thanks®ars Durgesh