Steven YaegerII

Ranch Hand
+ Follow
since May 31, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Steven YaegerII

I started coding again & going through mock exams and coding examples for all the questions that I get wrong. Then I came to the rules roundup question #36 "When you override a method, the overriding method in the subclass must not declare ANY new exceptions not declared in the overriden method?" (t/f).
So I read up a little bit and was going to code a subclass method overriding a base class method that declares a checked exception. Three variations of this would be: Subclass declares the same exception that the base class does, Sub declares no exceptions, and Sub declares a new checked exception. At first I was going to just override one of Java's core methods that throw a checked exception but since I got stuck so bad, I decided to first make my own exception class (Problem), then make a method that throws it (static void method(int, int) in class Roundup), and now that I've made it this far, I'll override static void method(int, int) from a subclass of Roundup to apply the three variations listed above.
So, the code is pretty trivial, its only purpose is so I can understand the principles to the questions that I get wrong. Just focusing on the Exception code and not the semantics of the other stuff, does it seem like it is set up how it should be?? I've always put off learning about exceptions, so I don't really know, but it felt kind've redundant while I was coding the exception stuff. (I guess I can remove the extends keyword from the class Roundup declaration.)
Thanks Marilyn
21 years ago
The code below gives 1 error: Exception Problem must be caught or it must be declared in the throws clause of this method. At Line14: method( digit, amount );
Well that's all fine & dandy, I know how to catch it, but I'm just trying to create my own checked exception with class Problem and have it thrown at compile time, by calling static void method( int num, int var ). So, my question is, "What changes do I need to make below so that when I compile it, the Problem exception is thrown and its message is displayed on screen?" Also, is the code structure on the right track or should I move something around (like putting the method( int num, int var ) in class Problem)? Everything I read about exceptions seems to confuse things twice as much as it clears things up.



Thanks, Steve
21 years ago
Never mind, it turns out that the files were just unreadable in NotePad but they are easy to read if you use Word. At first, I didn't think I was getting all that there was because when I'd copy & paste the source code, those little squares would disappear. I've only looked at a few files so far, and they look pretty empty without all those comments, but I think I got it now.
21 years ago
I've extracted all the files from src.jar with the command: jar xvf src.jar and it does give me all the .java files but I cannot really make any sense of them. To me, they look more like .class files than source code. I tried to paste a small snippet of Number.java here:
public abstract long longValue(); /**

...but none of the illegible stuff would transfer to this text area (all those litte squares). Is there another process that I need to put the files through before I can understand them?
21 years ago
That makes sense...gridlayout it is. Thanks, guys, for helping me out and also renewing my enthusiasm. SteveII
22 years ago
Thanks alot! I've been going batty trying to accomplish that very same thing. Looking back, I know I've come close more than once but I completely overlooked the layout managers. Thanks, Vinod, for getting me unstuck.
SteveII
22 years ago
It should come pretty easy, but it's not making sense why I cannot have a 500x300 pix frame
and inside it, have two 250x500 JPanels (side by side). I was hard at it for about a week and didn't even come close. I cannot even add a small JPanel to a JFrame without the panel taking up the whole frame.
In the following code, how can I add two TSPanels (side by side) to occupy one JFrame???

22 years ago
I know this is way off base, but I figured any opinions may be more valid coming from a site that isn't pushing the material. If anyone has experience in the area, how valuble is Comptia's A+ cert (core hardware test and OS test), and Network+ cert (N+ test)?
22 years ago
Whoops! Sorry I left you hanging. I thought that the review presented the question also, but I must be mistaken. What I did was copy all the questions and answers & start studying the ones that made no sense.
Thanks for confirming. I was having a hard time accepting it.
I'm pretty sure below works, though it's been awhile since I've used any special charachers:
System.out.println(" \"test\" ");
22 years ago

Above looks more like how I see it:
1 i=1 in //8
2 j=1 in //10
3 //13 is skipped & "i=1 j=1" is printed
4 j is incremented to 2
5 //12 evaluates true, so i is incremented to 2 & then
outer: continues
6 Now, the only way I see to avoid an infinite loop, and
for "i=2 j=1" to print, is for j to be re-initialized
back to 1??
Could this be close to what is happening?
Thanks. I looked into Assembler a few weeks back and was just curious. I don't believe I've noticed it before.
The output of below code is:
Value for i=1 Value for j=1
Value for i=2 Value for j=1

Could someone please outline the order of execution, as my thinking isn't meshing with the output? Isn't line 13 the only statement belonging to line 12? And couldn't lines 9 to 15 be considered statements that belong to the for loop at line 8?
[This message has been edited by Steven YaegerII (edited June 23, 2001).]
The code below yeilds button TWO, THREE, FIVE, FOUR, then ONE on the screen from left to right. All my other variations seem equally unpredictable. Can the order that components are placed in a FlowLayout be accurately determined? For example, I would think that the order should be ONE TWO THREE FOUR FIVE.

I did just notice that all 5 static FIELDS are for each row of components, but then LEFT seems to be the same as LEADING and RIGHT seems the same as TRAILING??
[This message has been edited by Steven YaegerII (edited June 23, 2001).]