Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

Jeff Tian

Greenhorn
+ Follow
since Jan 06, 2005
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 Jeff Tian

I'll give this a shot.

Polymorphism is about software reuse. It comes in the form or overloaded and overidden methods.

Overriden method is a method that a subclass inherits from a superclass with the following qualities:
- The subclass's method arg list must be the same
- return type must be the same
- access level (ie private public etc) must not be more restrictive than that of the parent class's method.
.
// The benefit of using overriden method is that I get to define a behavior that's more specific according to subclass type. Note that we also get to use methods belonging to Human without having to redeclare them in Jeff class. This will not be possible if I had Jeff as a class on its own without a superclass Human. ie Software reuse.

That is only 1 aspect of polymorphism. The other is overloading. Let me know if this helped. If yes, I'll tell more about overloading later. Or you can read the Bates and Sierra book, which gives a good explanation.
[ June 17, 2005: Message edited by: Jeff Tian ]
15 years ago
Gacu, I add my congrats to your already long list

2 exams in 3 weeks is awesome, and not to mention high scores. I doubt I can do an exam in that little time, let alone 2 on the same day.

Just wondering, are the SCBCD and SCWCD any more difficult to study and understand than the SCJP.

I'll get on to one of them, or both, as you have suggested, after I am done with the C# mcp that i am doing now.
15 years ago
It's actually nicer to have the book to sit down to, you can use tags more effectively and flip through back and forth the pages.

On A4 PDF, it gets a bit tedious going through the chapters.

Besides, you can get it fairly cheap from Amazon. The price in Aust is almost double the RRP in USA.

And the authors would luv you more for that too.
15 years ago
I am currently in Perth but, I will be travelling to Melb and Sydney in May with intention of looking for work and relocating.

Attended Uni of WA.

Ahh, the E word dreaded by many graduate jobseekers. You need experience to get job but need work to gain experience, hehehe.

Will 12 months risk management (internal auditing) experience count.

Gonna send out applications to
Perth:
- IBM, Micromuse, Honeywell, Motorola, UnisysWest, AlphaWest, ERG.

East:
- Already sent Accenture

How is the job market in Sydney for graduates, is it really like they say in The Australian paper - where "cocky grads are demanding and getting up to 70K". I doubt this, but looking at Seek vacancies, demand for experienced grads have improved a lot from last 2 years.

Do you have any recommendations for places to apply to in East.
Hi there Rose.

I think this is kinda what U R looking for. The submenu lets user choose b/n the always and never modes.

I had a submenu, with radio buttons and action listeners for them.

Put some of the variables as instance instead of local so action listener can reuse them.

Then I just set them according to listeners.

And I dunno what windowDestroyer is. Must be some weapon against bill gates.

It's messy. But here it is.


[ April 12, 2005: Message edited by: Jeff Tian ]
15 years ago
Hi there.

Based in Australia.

I was a graduate risk management consultant (non-IT) for about a year and stopped recently to certify my way back into a programming job.

I say back, because I have degrees in both accounting and computer science, but graduated in 2003, when there were no IT jobs at all. It's better now.

I have recently completed SCJP1.4, just yesterday actually.

To give myself the best chance of getting graduate developer job I am trying to get entry level certifications in as many popular languages/technologies as possible, starting with SCJP.

I am thinking a C# MCP (towards MCAD or MCSD.Net) next.

What do you think about my strategy, and any recommendations on certs to take.

Also, anyone in the same boat as me, just cant get away from programming and trying to get back into it, even when the industry was so sucky between 2001-2003. WOuld like to hear from you about your journey back.

BTW, are there any equivalent forums for MCSD / C# like javaranch.
Any code that you have after that do while loop will be unreachable.
You're right Ernest Friedman-Hill, it is to do with the IDE. The JVM executed the public class's main first when I used console instead.

I have never heard of this before. I was using Jcreator.

BTW, does having a public class and a default class in same file conceptually mean that the JVM should execute the public class's main first. Now, the more I think about it, the JVM doesn't really follow any rules in regard to class visibility.

Thanks for help guys, I was totally stumped.
[ March 29, 2005: Message edited by: Jeff Tian ]
15 years ago
Hi there.

I have placed 1 public and 1 default class in a file. The name matches the public class name.

class OtherClass{
public static void main(String[] args){
System.out.println("Inside OtherClass main");
}
}
public class ClassTester{
public static void main (String[] args) {
System.out.println("Inside ClassTester main");
}
}

I had intended for the JVM to execute the public class and not the default "OtherClass".

It appears that the JVM will just execute the whichever class comes first, in this case, the "OtherClass".

How do I make it execute the main in ClassTester first, without moving ClassTester on top of "OtherClass".

_________________________
BTW

If you are wondering why, I was writing exceptions within one source code file and thought that the public class would be executed first:

class AnotherException{
public static void main(String[] args){
System.out.println("Another Exception thrown");
}
}

class MyExceptionThree extends MyExceptionTwo{
public static void main(String[] args){
System.out.println("Exception 3 thrown");
}
}

class MyExceptionTwo extends MyExceptionOne{
public static void main(String[] args){
System.out.println("Exception 2 thrown");
}
}

class MyExceptionOne extends Exception{
public static void main(String[] args){
System.out.println("Exception 1 thrown.");
}
}

public class TestMyExceptions{
public static void main(String[] args) throws MyExceptionTwo, IOException
{
TestMyExceptions tester1 = new TestMyExceptions();
// Code that will cause some of my exceptions to be thrown
}
}
15 years ago
Hi KrishnaKumar.

Further to what Keith said,
I think question one also involves "implicit import" of java.lang.* library. I read somewhere that this happens, but I dunno much about it.

Note that Exception and other exceptions such as SecurityException, ArithmeticException are in the library and do not need any additional import declaration. See API.

If you want to use IOException, you have to import java.io and you also have to put some code in try block that will possibly throw IOException eg

FileReader fr = new FileReader("someFileName.txt");

As for Question 2, only Throwable and subclass can be caught (Keith) and while an exception is an object an object is not an exception.
[ March 29, 2005: Message edited by: Jeff Tian ]
I am thinking that:

Test1 is correct to fail compilation because the operator "can only be used to test objects against class types in same class hierarchy" (K&B). ie at the level in which they are declared (as opposed to Object level), C1 and C2 are clearly in different class hiearachies. So compilation rightly fails.

I am not sure about Test2, but my guess (a guess coming from someone who hasn't coded in 12 months :roll: but studying for SCJP now ) is that in the case of interfaces, it is still abtract, ie it does not yet belong to any particular class hierarchy.

Hopefully someone can confirm this.
[ March 25, 2005: Message edited by: Jeff Tian ]

Originally posted by Kedar Dravid:

If SourceType is an interface type, then, the reference value in srcref may be assigned to the destref reference, provided DestinationType is one of the following:
DestinationType is Object
DestinationType is a superinterface of subinterface SourceType

So, in the case of Test2, since ref is an Object, ref instance of I is valid.



Hi kedar.

I just wanted to clarify what you are saying about test2. Are you saying that interface I is an Object type and because of that, it will compile and run as false.