How can i write the following statements in Java ???
Hi Everyone,
I'm studying UML and according to my textbook, it says if 2 classes have the following relationship then it can be said that there's an association relationship between those 2 classesl.
Class A and B are associated if :
- an object of class A sends a message to an object of class B
- an object of class A creates an object of class B
- an object of class A has an attribute whose value are objects of class B or collections of objects of class B
- an object of class A receives a message with an object of class B as an argument.
However, I dunno how to write those stuff into Java codes. Can someone please kindly write Java codes for those sentences ?? Thanks everyone in advance.
Sorry guys. I know I shouldn't have asked in the first place without giving it a try first. Yeah, I been doing
Java without understanding the concept of real OOP and its terms.
- an object of class A sends a message to an object of class B // ?????
- an object of class A creates an object of class B // A obj=new A();
- an object of class A has an attribute whose value are objects of class B or collections of objects of class B // A varB;
- an object of class A receives a message with an object of class B as an argument. // ?????
I get confused with the very first line and the last line . I dunno what it means by sending a message but according to what JoachimSauer mentioned
it's "calling a method" but does that mean even I called an object of the same class within , can i still refers it as sending a message ?? Like what if
i call a static method of the calling object because I dun think i create an object when I call a static method ?
Let's say
class ExampleOne
public ExampleOne()
ExampleOne egOne=new ExampleOne();
egOne.display(); //can i refer to this as egOne object sending a message to an object of itself so the receiver is also egOne ??
public void displayOne()
System.out.println("Just an exampleOne");
class ExampleTwo
public ExampleTwo()
ExampleTwo.display(); // here no object creation occurs , just ExampleTwo class sends a message to itself so there's no association i assume .
public static void displayTwo()
System.out.println("Just an exampleTwo");
public class Main
public static void main(String args[])
ExampleOne exampleOne=new ExampleOne();
ExampleTwo exampleTwo=new ExampleTwo();
}I'm confused. at first , i thought sending a message means passing values as parameters when we call a function and receiving a message means the function
being called receive values as parameters. Phew, please help me out of this.
Similar Messages
-
How Can I Get The Cpu State With Java?
are there any method to use??
what's more,I also wanna to know how can I get
the current ram that the System is using
and the threads the System are running?
Will you please share your knowledge here or
write to tell me at [email protected]?
Thanks!!if you know how to do this in c++, you can write native methods and use them in java.
native methods forum:
http://forum.java.sun.com/forum.jsp?forum=52
tobias -
How can i write the below code using "For all entries"
Hi
How can we write the below code using "for all entries" and need to avoid joins...
Please help
SELECT aaufnr aobjnr aauart atxjcd a~pspel
agstrp awerks carbpl cwerks
INTO TABLE t_caufv
FROM caufv AS a
INNER JOIN afih AS b
ON aaufnr = baufnr
INNER JOIN crhd AS c
ON bgewrk = cobjid
AND c~objty = 'D'
WHERE ( a~pspel = space
OR a~txjcd = space
OR NOT a~objnr IN
( select OBJNR from COBRB AS e
WHERE objnr = a~objnr ) )
AND a~werks IN s_plant
AND a~auart IN s_wtype
AND NOT a~objnr IN
( select OBJNR from JEST AS d
WHERE objnr = a~objnr
AND ( dstat = 'A0081'OR dstat = 'A0018' )
AND d~inact 'X' ).
Reward points for all helpfull answers
Thanks
Ammi.Hi,
SELECT objnr objid aufnr
from afih
into table t_afih.
SELECT objnr
from JEST
into table t_JEST
where stat = 'A0045'
OR stat = 'A0046'
AND inact 'X'.
SELECT objnr
from COBRB
into table t_cobrb.
SELECT arbpl werks objid objty
from crhd
INTO table it_crhd
FOR ALL ENTRIES IN it_afih
WHERE objty eq 'D'
AND gewrk = it_afih-objid.
SELECT aufnr objnr auart txjcd pspel gstrp werks aufnr
FROM caufv
INTO table t_caufv
FOR ALL ENTRIES IN it_afih
WHERE aufnr = it_afih-aufnr
And pspel = ' '
AND txjcd = ' '
ANd objnr ne it_crhd-objnr
AND auart in s_wtype
AND werks in s_plant.
AND objnr ne it_jest-objnr.
dont use NE in the select statements, it may effect performance also. Instead use if statements inside
loops.
loop at t_caufv.
read table it_chrd............
if t_caufv-objnr ne it_chrd-objnr.
read table it_jest..........
if if t_caufv-objnr ne it_jest-objnr.
(proceed further).
endif.
endif.
endloop.
hope this helps.
Reward if useful.
Regards,
Anu -
How can I write a SQL statement which checks if a table exists?
How can I write a SQL statement which tells me whether a table exists?
execute an sql query: select * from <tablename>
catch the exception n check whether the erroe code
matches the one that occurs for table doesn't exist
that's itHow is your answer any different from the one given in the first reply?
It isn't.
As WorkForFood says DatabaseMetaData has a bunch of methods for getting information about tables but this is more useful when you don't know the names of any of the tables.. it sounds like you do so I would concur SELECT from table is probably the quickest way to go. If it helps the Xopen error should be either S1000 or 42S01 (I think) but I would try and see if there is a specific vendor code for table not found/not exists error and check for that. -
How can I write the analogous code to the logic:iterate tag functionality
Hai This is Rayalu .And I am very new to the Java World. I have a doubt?.How can I write the analogous code to the<logic:iterate> tag functionality using the JSP Tag Libraries . Pleae Send me some examples .
Hi,
SELECT objnr objid aufnr
from afih
into table t_afih.
SELECT objnr
from JEST
into table t_JEST
where stat = 'A0045'
OR stat = 'A0046'
AND inact 'X'.
SELECT objnr
from COBRB
into table t_cobrb.
SELECT arbpl werks objid objty
from crhd
INTO table it_crhd
FOR ALL ENTRIES IN it_afih
WHERE objty eq 'D'
AND gewrk = it_afih-objid.
SELECT aufnr objnr auart txjcd pspel gstrp werks aufnr
FROM caufv
INTO table t_caufv
FOR ALL ENTRIES IN it_afih
WHERE aufnr = it_afih-aufnr
And pspel = ' '
AND txjcd = ' '
ANd objnr ne it_crhd-objnr
AND auart in s_wtype
AND werks in s_plant.
AND objnr ne it_jest-objnr.
dont use NE in the select statements, it may effect performance also. Instead use if statements inside
loops.
loop at t_caufv.
read table it_chrd............
if t_caufv-objnr ne it_chrd-objnr.
read table it_jest..........
if if t_caufv-objnr ne it_jest-objnr.
(proceed further).
endif.
endif.
endloop.
hope this helps.
Reward if useful.
Regards,
Anu -
How can we remove the following zeros from quantity field ?
Hi All.
how can we remove the following zeros from quantity field while populating ALV by using FM REUSE_ALV_GRID_DISPLAY ?
eg:getting output zqty = 2.000
but i need zqty = 2.
help me to reslove this issue.
Regards.
jayHi,
While populating the field catlog do the following thing to avoid zeros.
wa_fieldcat-tabname = 'I_OUTPUT'. " Curr
wa_fieldcat-fieldname = 'FWAER'.
wa_fieldcat-seltext_l = text-023.
wa_fieldcat-no_zero = 'X'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Thanks,
Khushbu. -
How can we write the code for opening the command prompt and closing the
how can we write the code in java for opening the command prompt and closing the cmd prompt from eclipse (cmd prompt should close when click on the turminate button in eclipse)
rakeshsikha wrote:
how can we write the code for opening the command prompt and closing theBy typing in Eclipse (which you seemingly have)? -
How can I set the United States as my country when opening PSE 10?
How can I set the United States as my country when opening PSE 10 so I don't have to scroll down every time?
Why do you have to scroll down every time? You should only see the country window the very first time you launch PSE after installing it.
-
How can i write the floats value in Unitronics vision230 plc using modbus Ethernet
How can i write the Float value in unitronics Vision230 PLC usinsg modbus ethernet (MB Ethernet Master Query.vi) I read and write the 32 bit register, for e.g i want to write the 23.45 value on 2nd add. of MF. And MF register is 32 bit register. I read and write the 32 bit register.
Narendra.
Solved!
Go to Solution.Thanks Amit for your solution but i can not use the string to write the value because MB Ethernet master Query.vi only accepet the integer value its not take string values or any other i.e floats values etc.....otherwise i have no problem to write or read the 32 bit register values , only problem is that the MB Ethernet master Query.vi only accept the integer value there4 how can write the float value.
Narendra
Message Edited by Artemistech on 01-30-2009 11:06 PM -
How can i write the trigger for Global Temporary Table
Hi Grus,
How can i write the trigger for Global Temporary Table.
I was created the GTT with trigger using the below script .
CREATE GLOBAL TEMPORARY TABLE GLOBAL_TEMP
EMP_C_NAME VARCHAR2(20 BYTE)
ON COMMIT PRESERVE ROWS;
CREATE OR REPLACE TRIGGER TRI_GLOBAL_TEMP
BEFORE DELETE OR UPDATE OR INSERT
ON GLOBAL_TEMP
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
BEGIN
INSERT INTO EMPNAME VALUES (:OLD.EMP_C_NAME);
END;
trigger was create successfully, but the wouldn't insert into to EMPNAME Table..
Please guide whether am correct or not? if not kindly give a correct syntax with example
Thanks in Advance,
Arun M MBEGIN
INSERT INTO EMPNAME VALUES (:OLD.EMP_C_NAME);
END;
you are referencing old value in insert stmt.
BEGIN
INSERT INTO EMPNAME VALUES (:new.EMP_C_NAME);
END;then run ur application it works fine...
CREATE GLOBAL TEMPORARY TABLE GLOBAL_TEMP
EMP_C_NAME VARCHAR2(20 BYTE)
ON COMMIT PRESERVE ROWS;
CREATE OR REPLACE TRIGGER TRI_GLOBAL_TEMP
BEFORE DELETE OR UPDATE OR INSERT
ON GLOBAL_TEMP
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
BEGIN
dbms_output.put_line(:OLD.EMP_C_NAME||'yahoo');
INSERT INTO EMPNAME VALUES (:new.EMP_C_NAME);
dbms_output.put_line(:OLD.EMP_C_NAME);
END;
create table EMPNAME as select * from GLOBAL_TEMP where 1=2
insert into GLOBAL_TEMP values('fgfdgd');
commit;
select * from GLOBAL_TEMP;
select * from EMPNAME;
output:
1 rows inserted
commit succeeded.
EMP_C_NAME
fgfdgd
1 rows selected
EMP_C_NAME
fgfdgd
1 rows selectedgot it Arun
Edited by: OraclePLSQL on Dec 28, 2010 6:07 PM -
Can u write the following query without using group by clause
select sp.sid, p.pid, p.name from product p, supp_prod sp
where sp.pid= p.pid and
sp.sid = ( select sid from supp_prod group by sid
having count(*) =(select count(*) from product));
thru this, we retrieving all the products delivered by the supplier.
Can you write the following query without using the group by clauseselect sp.sid, p.pid, p.name
from product p, supp_prod sp
where sp.pid= p.pid the above query will still retrieve all the products supplied by the supplier. sub-query is not necessary.
maybe if you can post some sample data and output will help us understand what you want to achieve. -
How can i do the following in the oracle forms developer :
How can i do the following in the oracle forms developer :
1- delete or add new item to block and canvus at the RUNTIME ????
2- change the following property at the RUNTIME :
- item type
- datatype
- database item
- column nameHow can i do the following in the oracle forms
developer :
1- delete or add new item to block and canvus at the
RUNTIME ????It's not possible, you can do enabled/not enabled, or visible/not visible
2- change the following property at the RUNTIME :
- item typeno
- datatypeno
- database itemno
- column nameno
You are not lucky :-) -
How can i write the data to PIC16F819 using labview?
how can i write the data to PIC16F819 using labview?
Need help!
im using labview in gathering the datas that i need to right to the PIC, then after getting all the datas i am using another program which is ICD2 in order to write it to the PIC. Is it possible to do this task through LV? coz we are spending a lot of time transferring the data from LV to ICD2 manually and its prone to mistake as well.
any suggestion?
thanks,
PedzLabVIEW does not currently have a built-in method to communicate with
i2c, but there are other vendors that sell devices to communicate in
this manner with LabVIEW development kits. One that I know of is
from MCC... here is a link: http://www.mcc-us.com
They sell a device called iPort, and then you can buy LabVIEW VIs to go with it. I hope this is helpful to you!
john m -
How can we create the following DOC?
how can we create the following Documents?
Two Enquiry one quotation.
Two Quotation one Sales Order.
Two Sales Order one Delivery.
Two Delivery one Billing.Hi,
You need to execute the below transaction:
1) T.Code - VL11 : To create 2 different enquiry. To make a single Quotation for 2 enqury, use T.Code - VL21. Here once you enter the main screen, select drop down on Sales Document Type, the first option on topmest line & you will get an option --> Create with reference. Select the first enquiry & enter & repreat the sceond enquiry & enter. Now Both Enquiry will be a part of same Quotation.
2) T.Code - VL21: To create 2 different Quotation. To make a single Quotation for 2 enqury, use T.Code - VL01. Here once you enter the main screen, select drop down on Sales Document Type, the first option on topmest line & you will get an option --> Create with reference. Select the first enquiry & enter & repreat the sceond enquiry & enter. Now Both Quotation will be a part of same Order.
3) T.Code - VA01: To create 2 different Order. To make a single delivery, go to T.Code VL10A & select the 2 Order & create collective processing of Delivery to create a single Delivery.
4) T.Code - VL01N: To create 2 different Delivery (other T.codes can also be used to create delivery such as VL04, VL10A, VL10C, etc). To create single Billing for 2 Delivery, go to T.Code: VF01 & enter 2 Delivery numbers & press ENTER. This will merge 2 Delivery together.
Note: It is assumed that the parameter are common & meet the requirement for combining various documents.
Regards,
Rajesh Banka
Reward suitable points. -
How can I write the chinese characters in a web with my magic mouse?
How can I write the chinese characters in the search box with my magic mouse?
You can do it with a trackpad but I am not sure about the mouse. Take a look at his link, http://support.apple.com/kb/HT4288
Maybe you are looking for
-
I am finding iPhoto 08 difficult to use. I do not care for the new cropping function. With the window size I prefer, the floating menu that has the constrain menu and the "Cancel" and "Apply" buttons sits on top of the image at the lower edge. It als
-
Decryption on Yosemite going on for more than 24 hours now
Good morning or good day I am getting worried by the message of Freda of a year ago 2014 (Decryption stuck my MBP) , because my decrypting process is now on for almost 24 hours. I have a lot a third party Apps and many files too. So I didn't worry be
-
Resource on how to use C++ CX in a normal WPF Desktop App (on Windows 7?)
In my desktop app I am using both C# and Managed C++ I wonder if, going forward, I would be able to use C++ CX (instead of Managed C++) as it seems faster to run and easier to use. Note that I'm not going to port my App to metro and I plan on continu
-
Email links in Firefox 5.0 will not auto open in Outlook 2010 AND Windows Live Mail 2011
Outlook msg: General failure. An error occured in sending command to the application. Windows Line Mail: There was a problem sending command to the program.
-
Which tools best for which tasks and project workflow planning?
I am just getting comfortable with the basics of several CS tools and often need to use more than one to build a final product. Since I don't have a long history with the tools I still struggle learning which tool to use for specific tasks and then h