Please explain this code
I take the test and found this code-
public class Outer
{
public void someOuterMethod()
{
//Line 5
}
public class Inner { }
public static void main(String[] argv)
{
Outer ot = new Outer();
//Line 10
}
}
The following code fragments inserted, for compiling? | ||||||||
|
Answer is A.
Why not the answer is B?
well explained by cardan2
further explanation
Option A compile without problem
Option B gives an error - variable not static cannot be referenced from a static context.
There is no option package C only ot.
Option D gives an error - variable not static cannot be referenced from a static context.
hope you get it
Tags: Java
Similar Questions
-
Hello, when I look at this code, I do not understand a code, can someone explain this code?
Thank you very much!!!The creation of a 'method' for a vector object (in the old style of class definition), which gives it a method with an argument in degrees rotate.
It replaces the vector existing x and properties of y (in the part "with (this)" code) based on the angle that was passed.
I don't know if it gives correct results, because I don't check the math/trig, but it is the interpretation of what I see. What exactly do you want explained more in detail?
-
Please explain this part of the code
CREATE OR REPLACE PROCEDURE IS abc123
-Statements
v_T_MAP_record T_MAP_map % ROWTYPE;
TYPE t_element_cursor IS REF CURSOR;
v_T_MAP_cursor t_element_cursor;
number of v_T_MAP_count;
BEGIN
DBMS_OUTPUT. ENABLE (1000000);
v_T_MAP_cursor: = get_T_MAPs (1308); -This will get the record of the cursor
-Open the cursor
EXTRACTION v_T_MAP_cursor
IN v_T_MAP_record;
V_T_MAP_cursor % FOUND LOOP
dbms_output.put_line ('uc.use_case_id: ' | v_T_MAP_record.use_case_id);
v_T_MAP_count: = v_T_MAP_count + 1;
EXTRACTION v_T_MAP_cursor
IN v_T_MAP_record;
END LOOP;
-Close the cursor
CLOSE V_T_MAP_cursor;
EXCEPTION
While OTHERS THEN
dbms_output.put_line ('Error' |) TO_CHAR (SQLCODE) | ': ' || SQLERRM);
END;
I do not understand why we are having 2 game instruction Fetch IN v_T_MAP_record's first before the while loop v_T_MAP_cursor and the other inside the v_T_MAP_cursor. Please explain. If I remove the second instruction fetch inside the loop, it gives me a buffer overflow error.It's what he does...
CREATE OR REPLACE PROCEDURE abc123 IS --Variable declarations v_T_MAP_record T_MAP_map%ROWTYPE; TYPE t_element_cursor IS REF CURSOR; v_T_MAP_cursor t_element_cursor; v_T_MAP_count number; BEGIN DBMS_OUTPUT.ENABLE(1000000); -- THIS ISN'T REALLY NEEDED -- This opens the ref cursor, it doesn't fetch anything (assuming get_T_MAPs doesn't fetch itself) v_T_MAP_cursor := get_T_MAPs(1308); -- This fetches the first record from the cursor FETCH v_T_MAP_cursor INTO v_T_MAP_record; -- If a record is found we enter a loop WHILE v_T_MAP_cursor%FOUND LOOP -- output the current record details dbms_output.put_line('uc.use_case_id: '||v_T_MAP_record.use_case_id); v_T_MAP_count := v_T_MAP_count + 1; -- fetch the next record FETCH v_T_MAP_cursor INTO v_T_MAP_record; -- loop back to the start of the while loop END LOOP; --Close the cursor CLOSE v_T_MAP_cursor; -- Pointless stupid exception handler EXCEPTION when OTHERS THEN dbms_output.put_line('Error ' || TO_CHAR(SQLCODE) || ': ' || SQLERRM); END;
Although this would be a better style:
CREATE OR REPLACE PROCEDURE abc123 IS --Variable declarations v_T_MAP_record T_MAP_map%ROWTYPE; TYPE t_element_cursor IS REF CURSOR; v_T_MAP_cursor t_element_cursor; v_T_MAP_count number; BEGIN -- This opens the ref cursor, it doesn't fetch anything (assuming get_T_MAPs doesn't fetch itself) v_T_MAP_cursor := get_T_MAPs(1308); LOOP -- This fetches the first/next record from the cursor FETCH v_T_MAP_cursor INTO v_T_MAP_record; EXIT WHEN v_T_MAP_cursor%NOTFOUND; dbms_output.put_line('uc.use_case_id: '||v_T_MAP_record.use_case_id); v_T_MAP_count := v_T_MAP_count + 1; END LOOP; --Close the cursor CLOSE v_T_MAP_cursor; END;
However, I would also change things to use the SYS_REFCURSOR as the need to define your own type from the REF CURSOR was placed back in 9i with the new type built in SYS_REFCURSOR.
There are probably many other things I would like examine why I'm using ref Cursor in the first place and why I try to write data using dbms_output etc., but hey, we all have start somewhere.Published by: BluShadow on 28-Sep-2012 14:28
-
Hello
I'm prerparing to SCJP.
I got this question
What will be the result of the program?
{public}
public static throwit Sub)
{
System.out.Print ("throwit");
throw new RuntimeException();
}
Public Shared Sub main (String [] args)
{
Try
{
System.out.Print ("hello");
throwit();
}
catch (Exception)
{
System.out.Print ("taken");
}
Finally
{
System.out.Print ("finally");
}
System.out.println ("after");
}
}Hello throwit caught
Compilation failure
Hello throwit RuntimeException captured after
Hello throwit finally after
What is treatment and why. Please explain
answer would be D.
car-
The method main() correctly handles the RuntimeException in the catch block catch finally runs (as it always does), and then the code returns to normal.
A, B, and C are incorrect based on the logic of the program described above. Don't forget that properly handled exceptions do not cause the program to stop execution.
-
Hi, can someone please explain to me this code in detail?
$userReply = «»
While ($userReply - not "who's there?")
$userReply = read-host "TOC TOC!
Thank you
The - is a comparison operator and means 'different '.
For more information, see online courses of Tobias, the part on comparison operators (http://powershell.com/cs/blogs/ebook/archive/2009/03/08/chapter-7-conditions.aspx#table7.1) for example.
-
Hi all
Select col1, col2, col3, col4, col5, col6, count (*), grouping_id (col1, col2), grouping_id(col3,col4), grouping_id (col5, col6) of the Group FLAT_FILE_TEST of grouping sets (col3, col4), ((col1,col2) (col5, col6));
Separate Grouping_id here is 0 and 3
0 is for the current group, other grouping_id become 3.
Someone please explain meaning of 3
Why returning 3?
Thank you
Elayaperumal S
Hello
Thanks for posting the sample data. I get errors on all directions of INSERTION, because the column names aren't the names of columns in the CREATE TABLE statement.
Don't forget to post the results you want from these data, as well as an explanation of how you can (not necessarily how Oracle will be) the results of these data.
Maybe you have nothing particular in mind; you're just experimenting GROUPING_ID to see how it works.
In this case, if I have not answered your question in my first answer, so I understand not what is your question.
In general terms,.
GROUPING_ID (x_n,... x_2, x_1, x_0) equals
(GROUPING (x_n) * POWER (2, n)) +.
...
(GROUPING (x_2) * POWER (2, 2)) +.
(GROUPING (x_1) * POWER (2, 1)) +.
(GROUPING (x_0) * POWER (2, 0))
If you have any questions, please tell what it is. For example "on lines where gro1 = 7, why is - this 7 and not 4? Instead of theis... in language SQL manual it says... and you said... so I expect gro1 to 4 because... «,.
GROUPING_ID is so intimately linked to the GROUPING, then, in your result set, include GROUPING (x), where x is any column that you use as an agrument to GROUPING_ID, for ease of understanding.
-
Please explain these codes...
private var minefield: Array = new Array();
public void Main() {}
creation of mine field
for (var i: uint = 0; i < FIELD_H; i ++) {}
minefield [i] = new Array();
for (var j: uint = 0; j < FIELD_W; j ++) {}
mineField [i] .push (0);
}
trace ("line" + i + ":" + mineField [i]);
}
trace ("' the entire field of mines:" + minefield ");
end of the creation of mine field
}
It is a system of multiple table. I copied it from the book of game design. I would like to explain:
"Why to track'"mine field' is 81 zeros?""
OK, I predict (I understand the book), this minefield private var table is table of i and j
...
I also understood that mineField [i] is an array containing only the loop i ("0,1,2,3,4,5,6,7,8")
... and mineField [i] .push (0) changes all i - s in the table to 0?
Please, explain, everything is mixed in my head together
I do not know that try to explain it will make clearer for you, but here's a shot of her...
minefield is used as a multidimensional array, or in other words, it's an array with arrays.
In the loop by using 'i', each element of the minefield is assigned a new array in this line:
minefield [i] = new Array();
For the "j" loop, each element of the new array is assigned a value of 0 in this line.
mineField [i] .push (0);
The only values being assigned to arrays is 0, no 0,1,2,3,4,5,6,7,8,9
The last line is followed 81 most likely zeros because FIELD_H and FIELD_W are both equal to 9. Each element of the mines is a table with 9 zeros, so when you say that it trace the table it traces each element of this array, separated by commas. Given that each element of this array is another table, it traces the separated by commas, as well.
What this last trace is actually followed is 9 paintings, each containing 9 zeros.
-
Hello
It is the first program that I tried to write alone... and I'm stuck. I am trying to acquire data from a scope. I want the vi to load only the first field of application preparation time, the code is executed. Once the installation has been loaded, I want just the vi in order to reset the scope in order to acquire more data. I tried the first call, structures of the case,... all I can think about, but when I continually run the vi, it still loops and reloads the configuration every time. I have attached a picture of the code vi and describes the area of the code in question. The case structure is programmed to initialize the scope for open communications, then erase all existing data, and then call a program of specific scope to true. Wrong, I want only this setting of the code to initialize the communication within reach yet reminiscent of the configuration. A professional can explain it please how I'm supposed to accomplish this. Thank you
If you use RUN continuously to keep something running, you are indeed pushing the button RUN every time it stops, the function PREMI¨¨RE will return TRUE every time.
There are ways to do exactly what you're asking, but you are better off looking at the heart of your question:
You need a loop.
Put a loop around the part you want to do on several occasions.
Create a STOP button to stop the loop.
Make your INIT orders only once outside of the loop and make sure that the INIT part something happening in the WHILE loop
(to make sure that the loop starts after INIT).
-
can someone explain this code pls!
speed * =. 98;
(x = Math.sin(_rotation*(Math.PI/180)) * speed *-1;
y = Math.cos(_rotation*(Math.PI/180)) * speed *-1;
If (! _root.granica.hitTest (x, FLF, _x + y, true)) {}
_x += x;
FLF += y;
} else {}
speed * =-. 6;
}Granica root is an instance name that I used, it can be something else...
I think that shat speed is a variable or sth, cus I've already used it previously in the code and I guess now I'm just set...
but someone pleasee help out me by explaining what part of the code, we hear what may...
BTW I also think it has something to do with the trigonometric functions, that sin and cos...
TNX in advance
speed * =. 98; / / decreases the speed - IE, this object slow down gradually
(x = Math.sin(_rotation*(Math.PI/180)) * speed *-1; / / these two lines cause the object to move in the direction of _rotation, rotation of the object
y = Math.cos(_rotation*(Math.PI/180)) * speed *-1;
If (! _root.granica.hitTest (x, FLF, _x + y, true)) { / / This checks no imminent collision with _root.granica }
_x += x; / / If there is no collision that would happen, advance to this post
FLF += y;
} else {}
speed * =-. 6; / / If there is an imminent collision, not to move on this loop inversion with a lower speed
} -
Treatment of menu - please condense this code
Well, I have a menu on Frame1 of the main stage with 5 clips like menu bars. By pressing on the menu 1 must move the frame to the position of a main stage (at frame2). By pressing the 2nd menu will take you to the main stage image3. Etc, etc.
At any time, I put the "gotoAndStop (2)" directly in the line eventlistener, the function is executed on the test of the application. Thus, when you test the application, it begins to Frame2 instead of frame1 and nothing was clicked.
Can someone explain why this attached code works, but why any other method does not work? in terms of noob?
Thank youOkay, that's logic. Thank you. So I narrow down the code for that (see below). Seems to work very well.
Thank you
-
This message keeps popping up... does that mean?
Set WshShell = CreateObject ("WScript.Shell")Chr (34) WshShell.Run & "C:\Program Files\Verizon\IHA_MessageCenter\Temp\Start_SVC.bat" & Chr (34), 0Set WshShell = NothingThis message keeps popping up... does that mean?
Set WshShell = CreateObject ("WScript.Shell")Chr (34) WshShell.Run & "C:\Program Files\Verizon\IHA_MessageCenter\Temp\Start_SVC.bat" & Chr (34), 0Set WshShell = Nothinghttp://msdn.Microsoft.com/en-us/library/d5fk67ky%28V=vs.84%29.aspx
potentially, this could be a useless program / unwanted...
-
Can someone please explain this to me
So yesterday, I made a change in our production database. What we had was a synonym in the S1 schema that pointed to a view of schema S2. We needed to make a change to do some minor data manipulations before we see in S1. So I dropped the synonym and created a view of the same name. All this went well in dev and QA, where we register S1 to do all the tests, but in production, our application connects to the database as S1USER that has select privileges on all tables of S1 and the views. After you have created the user view privileges granted DBA select on view at S1USER, but when I tried to query the table like S1USER I got ORA-01031: insufficient privileges. The DBA has thought that I didn't select privileges on the underlying view in S2, so it has that. Again I got the error of insufficient privileges. He seems to have had the privilege to choose granted by the account DBA was not good enough, he had to be granted by S1. I have never heard something like that. Why don't the DBA grant select to do the job, and select should be granted by the owner of the schema. Someone at - he never encountered this before?
Even if ADMINISTRATOR privilege, he did on behalf of S1, considered as a DBA user:
SQL > grant create session to one identified by one;
Grant succeeded.
SQL > grant select on mpprod.indv_t to one.
Grant succeeded.
SQL > select table_name, constituent
2 of dba_tab_privs
3 where dealer = "A";TABLE_NAME GRANTOR
------------------------------ ------------------------------
INDV_T MPPRODHowever, nor the role of s/n, not the DBA have with grant on the indv_t table option, the ADMINISTRATOR cannot transmit the (implicit) permissions on the table S2 S1 at S1user. Only S1 can transmit the implicit permissions to table S2.
John
-
Level - Can Reporting someone please explain this attribute?
All - I am a newbie on Siebel on demand but creating reports with other tools for years. I recently came across some reports that I inherited that constantly give us bad. These are basic reports that look at the number of calls, meetings, etc. for a given user. What we see is that we used this statement attribute level to filter, but according to the Manager of logging level in it cause problems. Some people cannot see the data, and some receive a massive amount of duplicated data.
When all is said and done, we are looking for a simple list of Manager-rep of counts of these activities. After looking at the value of level reporitng it would look like an indicator of the relative position of the level lower in the reports - to the hierarchy. We will generally filter level = 0 (or maybe 1) reports more but what I want is a way to control based on the user. My requirement is to have the level they can see and retail at a level more low but I don't ' fully understand how that is created or how can I use system variables to determine the level of user control.
Anyone who has the news of background on this page or how I can order a basic report anaylytic in more manageable to show my stuff and subtotals to a level more down which would be greatly appreciated.Not sure if I can help with the specific report, but I'll try more of light level Reporting.
In a report which is flush with the dimension possessed by the user, you can find the Reporting level field. Each user belongs to a reporting hierarchy, derived from the "Reports To" value in their user profile.
The best way to see it is to create a simple report with the Email of the user level reports and email Manager. This will show you the Manager at each level. You can use this to expose and filter on the complete management hierarchy.
Level 0 = user. All users have a value of themselves as Manager at level 0.
Level 1 = reports to-which reports directly to the user.
Level 2 + = towards the top of the chain...You can take a look at some of the predefined reports to see how this can be used to create reports based team, as 'Team Pipeline Analysis', ' team sales analysis of efficiency "and"analysis of the Team activity. You can open all the pre-buiilt reports as well as the starting points.
-
SQL: can someone please explain this question?
Select to_char (-4567, ' 9999 mI') a1, to_char (-4567, '99999pr') n2, to_char (4567, '00099999') double a3
Select to_char (4567, '9.999EEEE') a1, to_char (4567, '9999V9999') double n2
--
Thank you
You need to consider the Format of number patterns
http://docs.Oracle.com/database/121/SQLRF/sql_elements004.htm#SQLRF00211
-
Please explain this SQL output
How can we get the lines with1* SELECT style, window, TO_CHAR(rate, '999,999.99') rate FROM ship_cabins ORDER BY 1,2 SQL> / STYLE WINDOW RATE --------------- ---------- ----------- Stateroom None 555.65 Stateroom Ocean 5,000.00 Stateroom Ocean 500.00 Suite None 300.00 Suite None 25.00 Suite Ocean 333.44 Suite Ocean 444.55 Suite Ocean 123.78 Suite Ocean 666.66 9 rows selected. SELECT style, window, rate FROM ship_cabins WHERE style= 'Suite' AND NOT window = 'Ocean' OR rate > 500; SQL> / STYLE WINDOW RATE --------------- ---------- ---------- Suite None 300 Stateroom Ocean 5000 Suite None 25 Stateroom None 555.65 Suite Ocean 666.66
?rate <= 500
How can we get the lines with
?window = 'Ocean'
Published by: 957072 on April 4, 2013 04:23Hello
957072 wrote:
1* SELECT style, window, TO_CHAR(rate, '999,999.99') rate FROM ship_cabins ORDER BY 1,2 SQL> / STYLE WINDOW RATE --------------- ---------- ----------- Stateroom None 555.65 Stateroom Ocean 5,000.00 Stateroom Ocean 500.00 Suite None 300.00 Suite None 25.00 Suite Ocean 333.44 Suite Ocean 444.55 Suite Ocean 123.78 Suite Ocean 666.66 9 rows selected. SELECT style, window, rate FROM ship_cabins WHERE style= 'Suite' AND NOT window = 'Ocean' OR rate > 500; SQL> / STYLE WINDOW RATE --------------- ---------- ---------- Suite None 300 Stateroom Ocean 5000 Suite None 25 Stateroom None 555.65 Suite Ocean 666.66
OR meanis includes the lines if they meet either the conditon before the OR keyword, or condition that comes after it.
How can we get the lines with
rate <= 500
?
These lines meet the other condition: NO window = "Ocean."
How can we get the lines with
window = 'Ocean'
?
These lines satisfy the condition else: rates > 500
If you want lines that meet all the criteria, then use AND place where.
If you want to use both AND and OR in the WHERE clause even, use parentheses to indicate clearly who will be evaluatd forst.
For example:WHERE ( style = 'Suite' AND NOT window = 'Ocean' ) OR rate > 500
Maybe you are looking for
-
Can I use 2 monitors on iMovie 10?
I can not find how do. There is no advanced on 10 iMovie preferences. What are the other possibilities do I have? Maybe go with the old version of iMovie? Thank you
-
Re: Tecra M10 stops down if it is locked and then login again (XP pro)!
Hello A few weeks ago, I got a * Toshiba Tecra M10 * my company which I use as mobile office.I have downgraded to Windows XP pro, which was delivered with the M10. The laptop works fine except one question:* If I lock Windows using the < CTRL > + < a
-
Satellite L500-1 - where to find the drivers for XP and Windows 7?
For me, are necessary for the driver to L500-1. On a site not found. If it is a good idea to use the driver other model of what to write. To me, the driver under Windows XP, Windows 7.
-
Momentum back to the default values
Is there a way to LabVIEW to easily cause a string/int/dbl back to its default value after an event? I'm trying to make a user interface that is going through the same stage of many times and it would be easier to set the default input values after e
-
original title: dozens and dozens of copies on my desk! When I tried to save copies of some e-mails on a disc, multiple copies of each email appeared on my desktop running Windows XP. When I try to delete them, more appear. Similarly when I drag an