Can you explain this link?

See my code first:

class MyClass {

public static void main(String[] arguments) {

System.out.print("Can you explain it?");

}

}

'System' is a pre-defined class in java API. 'MyClass' is defined by me. How & What relationship develops between both classes that enables me to write 'System.out.print("Can you explain it?")' inside 'MyClass'?

Simply, what relationship develops between class System and MyClass?

[469 byte] By [New-Drop@Java-Seaa] at [2007-11-26 13:55:37]
# 1
> Simply, what relationship develops between class> System and MyClass?Any class imports java.lang.* by default. The System class is a part of the java.lang package. So, it can be used within the "MyClass"
aniseeda at 2007-7-8 1:34:45 > top of Java-index,Java Essentials,New To Java...
# 2
What are you asking?out is a Static variable. There doesn't need to be a relationship between System and your class.
zadoka at 2007-7-8 1:34:45 > top of Java-index,Java Essentials,New To Java...
# 3
That's is not the answer. You still fail to explain link between System and MyClass.
New-Drop@Java-Seaa at 2007-7-8 1:34:45 > top of Java-index,Java Essentials,New To Java...
# 4
> That's is not the answer. You still fail to explain> link between System and MyClass.Improve your question. Define: "link"
zadoka at 2007-7-8 1:34:45 > top of Java-index,Java Essentials,New To Java...
# 5
> That's is not the answer. You still fail to explain> link between System and MyClass.I think you fail to ask a good enough question.All I'd say is that the relationship is:MyClass is using the System class.
warnerjaa at 2007-7-8 1:34:45 > top of Java-index,Java Essentials,New To Java...
# 6

> > That's is not the answer. You still fail to

> explain

> > link between System and MyClass.

>

> I think you fail to ask a good enough question.

> All I'd say is that the relationship is:

> MyClass is using the System class.

The question is crystal clear. You must pay attention to it. Now, you say MyClass is using the System class. I ask, what principle of java language makes it legal to use System class inside MyClass?

New-Drop@Java-Seaa at 2007-7-8 1:34:45 > top of Java-index,Java Essentials,New To Java...
# 7

> The question is crystal clear. You must pay attention

> to it.

I find your attitude a bit offensive. Carry on like this and you'll get more than enough of the big heave-ho outta here.

> Now, you say MyClass is using the System

> class. I ask, what principle of java language makes

> it legal to use System class inside MyClass?

Principle? It's just part of the language. If classes couldn't use each other, it wouldn't be much of a useful language at all.

warnerjaa at 2007-7-8 1:34:45 > top of Java-index,Java Essentials,New To Java...
# 8
> The question is crystal clear. This is incorrect.Read this: http://catb.org/esr/faqs/smart-questions.html
zadoka at 2007-7-8 1:34:45 > top of Java-index,Java Essentials,New To Java...
# 9
> The question is crystal clear. You must pay attention> to it.If the question is crystal clear, you know the answer. Pay attention to your textbooks.
aniseeda at 2007-7-8 1:34:45 > top of Java-index,Java Essentials,New To Java...
# 10
> Simply, what relationship develops between class> System and MyClass?I wouldn't use the word "develops" here as it suggest something that is changing or growing. Instead I would ask "what relationship exists between...". But in any case my answer would be "None."
DrClapa at 2007-7-8 1:34:45 > top of Java-index,Java Essentials,New To Java...
# 11

The relationship is this:

System married Dave.

Dave has a brother called Jo

Jo has 3 kids.

One of them has one leg shorter than the other.

But the eldest got married to a Thai ladyboy, unbeknownst to himself, called Colin.

Colin's dad works in a chicken factory with Chu Man Fat.

Chu Man fat has a twice removed uncle called Swa Lo.

Swa Lo has a sister called Mylene Klass or shortened to MyClass.

Ted.

ted_trippina at 2007-7-8 1:34:45 > top of Java-index,Java Essentials,New To Java...
# 12

> The relationship is this:

>

> System married Dave.

> Dave has a brother called Jo

> Jo has 3 kids.

> One of them has one leg shorter than the other.

> But the eldest got married to a Thai ladyboy,

> unbeknownst to himself, called Colin.

> Colin's dad works in a chicken factory with Chu Man

> Fat.

> Chu Man fat has a twice removed uncle called Swa Lo.

> Swa Lo has a sister called Mylene Klass or shortened

> to MyClass.

>

> Ted.

I'm afraid that a serious question is being 'enjoyed' instead of being 'faced' seriously.

New-Drop@Java-Seaa at 2007-7-8 1:34:45 > top of Java-index,Java Essentials,New To Java...
# 13
> I'm afraid that a serious question is being 'enjoyed'> instead of being 'faced' seriously.What's there to face?Face it! You don't understand a simple thing.
aniseeda at 2007-7-8 1:34:45 > top of Java-index,Java Essentials,New To Java...
# 14

> I'm afraid that a serious question is being 'enjoyed'

> instead of being 'faced' seriously.

Well if you're still in the dark as you apparantly are about it, then the question I'd ask myself if I were you would be this:

Am I sure I'm in the right field of study / profession for my capabilities?

warnerjaa at 2007-7-8 1:34:45 > top of Java-index,Java Essentials,New To Java...
# 15

>

> I'm afraid that a serious question is being 'enjoyed'

> instead of being 'faced' seriously.

Your question has been answered several times, seriously. You responded with "Pay attention". I wouldn't expect much after demonstrating what a bad attitude you have.

If you don't llike the answer then there is little anyone can do to help you other than take warnerja's advice.

The answer is "there is no relationship". You appear to be getting terms confused. I believe you might be thinking of the "extend" keyword or along those lines. Classes do not have to be "related" in order to use each other. Relationships come into play when you have public/private/protected methods. For example:public ClassA {

protected void doStuff()

{

}

}

public ClassB extends ClassA {

protected void doMoreStuff()

{

doStuff();

}

}

public ClassC {

protected void doMoreStuff()

{

doStuff();

}

}

Here ClassB is able to call doStuff() as it extends ClassA. But, ClassC can not do that as it does not extend ClassA.

Ted.

ted_trippina at 2007-7-21 15:58:00 > top of Java-index,Java Essentials,New To Java...
# 16
New-Drop@Java-Sea <--Another Billgates in the house trying to change the world of Java lol.
fastmikea at 2007-7-21 15:58:00 > top of Java-index,Java Essentials,New To Java...
# 17

> Your question has been answered several times,

> seriously. You responded with "Pay attention". I

> wouldn't expect much after demonstrating what a bad

> attitude you have.

>

> If you don't llike the answer then there is little

> anyone can do to help you other than take warnerja's

> advice.

>

> The answer is "there is no relationship". You appear

> to be getting terms confused. I believe you might be

> thinking of the "extend" keyword or along those

> lines. Classes do not have to be "related" in order

> to use each other. Relationships come into play when

> you have public/private/protected methods. For

> example:> public ClassA {

>protected void doStuff()

> {

>}

>

> public ClassB extends ClassA {

>protected void doMoreStuff()

> {

>doStuff();

>

> }

> public ClassC {

>protected void doMoreStuff()

> {

>doStuff();

>

> }

> Here ClassB is able to call doStuff() as it extends

> ClassA. But, ClassC can not do that as it does not

> extend ClassA.

>

> Ted.

Well Ted! i'm not rude at all. I'm novice to java programming and that is why i join the forum 'New To Java'. Now, what you answer is what i was looking for. This part of your answer clears my mind.

"Classes do not have to be "related" in order to use each other. Relationships come into play when you have public/private/protected methods."

Thankyou and i hope you change your opinion about me.

New-Drop@Java-Seaa at 2007-7-21 15:58:00 > top of Java-index,Java Essentials,New To Java...
# 18
> Well Ted! i'm not rude at all. That might be perfectly true. But you come across as rude whether it is true or not. I would suggest you read over this: http://catb.org/esr/faqs/smart-questions.html
zadoka at 2007-7-21 15:58:00 > top of Java-index,Java Essentials,New To Java...
# 19

> That's is not the answer. You still fail to explain

> link between System and MyClass.

> he question is crystal clear. You must pay attention to it.

I'm glad I've answered your question. As well as learning Java I would also brush up on your English as the above things u posted before ARE rude whether you like it or not.

Happy coding :o)

Ted.

ted_trippina at 2007-7-21 15:58:00 > top of Java-index,Java Essentials,New To Java...
# 20

You must read a Java tutorial.

MyClass use System.out.

http://java.sun.com/javase/6/docs/api/java/lang/System.html#out

MyClass can use System.out.println("afasfasfasf") because:

-System is public in a imported package, java.lang (it always is imported implicitly).

-Being a public class of imported package, out property is public.

-println is a public method of declared type of property out of imported class.

ok?

govisagod512a at 2007-7-21 15:58:00 > top of Java-index,Java Essentials,New To Java...
# 21

As somebody mentioned previously, System is static, had it not been it would or rather could have been aggregation or composition, depending on how it was used. As far as which principle is being satisfied here, I am not sure what the context of the question is. Its obviously not inheritance, its can be encapsulation, its not polymorphism either. If that doesnt satisfy the principle question, it is not LSP has nothing to do with Open closed principle. or anything closed to that. HTH

kilyasa at 2007-7-21 15:58:00 > top of Java-index,Java Essentials,New To Java...
# 22
> As somebody mentioned previously, System is static,Actually, "out" is a static member of the System class. "System is static" doesn't mean much (if anything)--it is certainly not a static class (a top-level class cannot be static--only nested classes can be).
doremifasollatidoa at 2007-7-21 15:58:00 > top of Java-index,Java Essentials,New To Java...
# 23

> > As somebody mentioned previously, System is

> static,

>

> Actually, "out" is a static member of the System

> class. "System is static" doesn't mean much (if

> anything)--it is certainly not a static class (a

> top-level class cannot be static--only nested classes

> can be).

I meant System.out, guess missed that. Thanks for the correction.

kilyasa at 2007-7-21 15:58:00 > top of Java-index,Java Essentials,New To Java...
# 24

> > The question is crystal clear. You must pay

> attention

> > to it.

> I find your attitude a bit offensive. Carry on like

> this and you'll get more than enough of the big

> heave-ho outta here.

It seems that we have a commander here. "You must pay attention, soldier!" :-)

Jeezuz, and the year is just beginning...

The OPs are becoming more and more worse!

TheLoosera at 2007-7-21 15:58:00 > top of Java-index,Java Essentials,New To Java...
# 25
"New-Drop@Java-Sea"And the rule still works...everybody who has "Java" in the name doesnt deserve a good help at all. Especially if the name is also a fancy one, like the OPs nick.
TheLoosera at 2007-7-21 15:58:00 > top of Java-index,Java Essentials,New To Java...
# 26

It's always nice when someone comes here and demands answers to their "crystal clear" question when it doesn't appear they're even sure they know what they're trying to ask. You continue to reinforce this opinion by acting like an ignorant, yet arrogant fool who is treating people as if they're his students who he has to whip in to shape.

kablaira at 2007-7-21 15:58:00 > top of Java-index,Java Essentials,New To Java...
# 27

> It's always nice when someone comes here and demands

> answers to their "crystal clear" question when it

> doesn't appear they're even sure they know what

> they're trying to ask. You continue to reinforce

> this opinion by acting like an ignorant, yet arrogant

> fool who is treating people as if they're his

> students who he has to whip in to shape.

Im sorry, but did you reply to me? (I tried to understand you, but honestly I couldnt. Sometimes I have problems with English)

TheLoosera at 2007-7-21 15:58:00 > top of Java-index,Java Essentials,New To Java...
# 28
Not unless you're the same person who just posted a "crystal clear" question and demanded answers then said things like "pay attention" and demanded better answers.*cough* OP *cough*
kablaira at 2007-7-21 15:58:00 > top of Java-index,Java Essentials,New To Java...
# 29

> MyClass can use System.out.println("afasfasfasf")

> because:

> -System is public in a imported package, java.lang

> (it always is imported implicitly).

> Being a public class of imported package, out

> property is public.

> -println is a public method of declared type of

> property out of imported class.

>

> ok?

Nice answer. You really clarified my mind. Thank you.

New-Drop@Java-Seaa at 2007-7-21 15:58:00 > top of Java-index,Java Essentials,New To Java...
# 30

Some of you blamed me arrogant, rude etc. You may be right in saying that but wrong in understanding me. I was really irritated by irrelevant answers.

If my question seems to you unclear then don't forget i'm a novice at New To Java.

So, many replies to my message are not related to 'Java'. I may be equally responsible for that. So, i want to close this chapter.

I have got the answer for my message. I APOLOGIZE for my wordings if it hurt you anyway.

Wishing best for you all

Bye

New-Drop@Java-Seaa at 2007-7-21 15:58:05 > top of Java-index,Java Essentials,New To Java...
# 31

> Some of you blamed me arrogant, rude etc.

Because that's how you acted. This is not a matter of opinion.

> You may be

> right in saying that but wrong in understanding me.

Whether anybody understands you is completely unrelated to whether you were rude.

If you want your question answered, BOTH of the following criteria must be met:

* You must not be a rude arrogant buttface.

* You must communicate your problem clearly.

You failed on both counts.

> If my question seems to you unclear then don't forget

> i'm a novice at New To Java.

You should still be able to communicate. Furthermore, when the people whose help you're soliciting say that you're not communicating clearly, being a whiny ***** and denying that fact while being rude will NOT help your cause. If you don't like it, too bad; that's life.

jverda at 2007-7-21 15:58:05 > top of Java-index,Java Essentials,New To Java...
# 32

> You should still be able to communicate. Furthermore,

> when the people whose help you're soliciting say that

> you're not communicating clearly, being a whiny

> ***** and denying that fact while being rude will

> NOT help your cause. If you don't like it, too bad;

> that's life.

What kind of mentality it is? You ignore my big APOLOGIZE and keep on saying a whiny *****? You claim to be the champion of Etiquettes by advising me in that rough way!

New-Drop@Java-Seaa at 2007-7-21 15:58:05 > top of Java-index,Java Essentials,New To Java...
# 33

Frankly, you deserve the abuse. Saying "I apologize" isn't going to make people suddenly say "Oh well then everything is forgiven" and never say a word about it again. Endure a bit of it and people will stop. Be respectful and polite in the future and people will be inclined to do the same with some exception.

If you lash out at people flaming you for what you said then you perpetuate it.

kablaira at 2007-7-21 15:58:05 > top of Java-index,Java Essentials,New To Java...