Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.help > #476 > unrolled thread
| Started by | Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> |
|---|---|
| First post | 2011-04-02 22:13 +0200 |
| Last post | 2011-04-06 12:08 -0400 |
| Articles | 17 on this page of 37 — 8 participants |
Back to article view | Back to comp.lang.java.help
Class ... implements ... Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-02 22:13 +0200
Re: Class ... implements ... Lew <noone@lewscanon.com> - 2011-04-02 17:30 -0400
Re: Class ... implements ... Roedy Green <see_website@mindprod.com.invalid> - 2011-04-02 23:09 -0700
Re: Class ... implements ... Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-03 12:00 +0200
Re: Class ... implements ... Roedy Green <see_website@mindprod.com.invalid> - 2011-04-02 20:53 -0700
Re: Class ... implements ... Stanimir Stamenkov <s7an10@netscape.net> - 2011-04-03 10:15 +0300
Re: Class ... implements ... Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-04-03 08:42 -0400
Re: Class ... implements ... Roedy Green <see_website@mindprod.com.invalid> - 2011-04-03 06:45 -0700
Re: Class ... implements ... Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-03 17:29 +0200
Re: Class ... implements ... Patricia Shanahan <pats@acm.org> - 2011-04-03 09:01 -0700
Re: Class ... implements ... Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-03 18:10 +0200
Re: Class ... implements ... Patricia Shanahan <pats@acm.org> - 2011-04-03 09:32 -0700
Re: Class ... implements ... Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-03 18:48 +0200
Re: Class ... implements ... Aéris <aeris@imirhil.fr> - 2011-04-03 18:07 +0200
Re: Class ... implements ... Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-03 18:22 +0200
Re: Class ... implements ... Aéris <aeris@imirhil.fr> - 2011-04-03 19:02 +0200
Re: Class ... implements ... Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-03 20:15 +0200
Re: Class ... implements ... Lew <noone@lewscanon.com> - 2011-04-06 12:01 -0400
Re: Class ... implements ... Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-03 17:27 +0200
Re: Class ... implements ... Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-04-03 14:26 -0400
Re: Class ... implements ... Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-04-03 16:14 -0300
Re: Class ... implements ... Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-03 21:33 +0200
Re: Class ... implements ... Aéris <aeris@imirhil.fr> - 2011-04-03 22:13 +0200
Re: Class ... implements ... Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-03 22:24 +0200
Re: Class ... implements ... Lew <noone@lewscanon.com> - 2011-04-06 12:05 -0400
Re: Class ... implements ... Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-03 17:31 +0200
Re: Class ... implements ... Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-04-03 14:41 -0400
Re: Class ... implements ... Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-03 21:45 +0200
Re: Class ... implements ... Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-04-03 16:40 -0400
Re: Class ... implements ... Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-03 22:58 +0200
Re: Class ... implements ... Lew <noone@lewscanon.com> - 2011-04-06 12:13 -0400
Re: Class ... implements ... Lew <noone@lewscanon.com> - 2011-04-06 12:10 -0400
Re: Class ... implements ... Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-03 21:51 +0200
Re: Class ... implements ... Patricia Shanahan <pats@acm.org> - 2011-04-03 13:02 -0700
Re: Class ... implements ... Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-03 22:23 +0200
Re: Class ... implements ... Lew <noone@lewscanon.com> - 2011-04-06 12:15 -0400
Re: Class ... implements ... Lew <noone@lewscanon.com> - 2011-04-06 12:08 -0400
Page 2 of 2 — ← Prev page 1 [2]
| From | Arved Sandstrom <asandstrom3minus1@eastlink.ca> |
|---|---|
| Date | 2011-04-03 16:14 -0300 |
| Message-ID | <IG3mp.4655$J36.3747@newsfe08.iad> |
| In reply to | #500 |
On 11-04-03 12:27 PM, Merciadri Luca wrote: [ SNIP ] > Thanks for the tips. I'll try to get a textbook. The problem is that > I'm learning Java for some course and that I don't have a sufficient > amount of (academic) time to learn Java in depth. So I'll try to do my best. Ideally you're not learning Java only to pass a course, although it's good if you do pass the course. :-) Having said that, what kind of course is it where you have to learn Java but don't even have a textbook for it? At this starter level you honestly don't even need a textbook - you really don't. What you need to know - minimum - can be found at http://download.oracle.com/javase/tutorial/, specifically in the "Trails Covering The Basics" section. If you read and understand this you'll save yourself a lot of time and effort. No textbook out there is going to do a better job at explaining the basics. The very first Java printed reference I ever had (and still have) was 2nd edition "Java In A Nutshell", 1997, covering Java 1.1, and looking at it now I see that there's nothing in it that wouldn't be available online. I doubt the later editions are qualitatively different. You've already invested a fair bit of effort in this by asking questions here, and a somewhat painful process it's been. If you look at the Java Tutorials now, I suspect a fair few things will fall into place. If you don't mind me asking, is this also your first programming language? AHS -- That's not the recollection that I recall...All this information is certainly in the hands of the auditor and we certainly await his report to indicate what he deems has occurred. -- Halifax, Nova Scotia mayor Peter Kelly, who is currently deeply in the shit
[toc] | [prev] | [next] | [standalone]
| From | Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> |
|---|---|
| Date | 2011-04-03 21:33 +0200 |
| Message-ID | <87hbafgmex.fsf@merciadriluca-station.MERCIADRILUCA> |
| In reply to | #520 |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Arved Sandstrom <asandstrom3minus1@eastlink.ca> writes: > On 11-04-03 12:27 PM, Merciadri Luca wrote: > [ SNIP ] > >> Thanks for the tips. I'll try to get a textbook. The problem is that >> I'm learning Java for some course and that I don't have a sufficient >> amount of (academic) time to learn Java in depth. So I'll try to do my best. > > Ideally you're not learning Java only to pass a course, although it's > good if you do pass the course. :-) Having said that, what kind of > course is it where you have to learn Java but don't even have a textbook > for it? > > At this starter level you honestly don't even need a textbook - you > really don't. What you need to know - minimum - can be found at > http://download.oracle.com/javase/tutorial/, specifically in the "Trails > Covering The Basics" section. If you read and understand this you'll > save yourself a lot of time and effort. No textbook out there is going > to do a better job at explaining the basics. The very first Java printed > reference I ever had (and still have) was 2nd edition "Java In A > Nutshell", 1997, covering Java 1.1, and looking at it now I see that > there's nothing in it that wouldn't be available online. I doubt the > later editions are qualitatively different. > > You've already invested a fair bit of effort in this by asking questions > here, and a somewhat painful process it's been. If you look at the Java > Tutorials now, I suspect a fair few things will fall into place. > > If you don't mind me asking, is this also your first programming language? I'll look at your link. Not at all my first programming language, but sure I'm not really confident with some aspects of OOP, especially here because of the differences between experts and a beginner like me. Well, some concepts are installing progressively. There is no problem about the course, which is well taught. The problem is that some questions are asked on specific aspects of the Java language (such as some aspects over which I asked questions earlier), and a normal student could not be answer all these questions by only reading the slides, which already provide important information. As a result, I'll need to document myself for some specific aspects. I'm conscient of this. - -- Merciadri Luca See http://www.student.montefiore.ulg.ac.be/~merciadri/ - -- If it's worth doing, it's worth over-doing. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/> iEYEARECAAYFAk2Yy4UACgkQM0LLzLt8MhxrOACbBwVWdfJ8BIdInRqqk6RSiKMf nUMAn1+m6OeRkPlUGt20+wgVQ3aD1xwi =mSZb -----END PGP SIGNATURE-----
[toc] | [prev] | [next] | [standalone]
| From | Aéris <aeris@imirhil.fr> |
|---|---|
| Date | 2011-04-03 22:13 +0200 |
| Message-ID | <4d98d4d6$0$26053$426a74cc@news.free.fr> |
| In reply to | #521 |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Le 03/04/2011 21:33, Merciadri Luca a écrit : > The > problem is that some questions are asked on specific aspects of > the Java language No, most of your questions is only in the OOP scope, not in the Java one. Your questions can be applied on C# or Python instead of Java without changing the responses, for example about inheritance, up/down-casting, equals/identity, accessor scope and accessibility, etc. - -- Aeris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJNmNTRAAoJEK8zQvxDY4P9vL0IAJpMgpaWNH7EfFOv67w3gOja SCqCulmuRrdp1FATfxen6BJg+iOs4Unrs16lGGvGyRINlKNCAIDki7o+gD59ZqOA 3Gok3NiT3GJPkelBS36lfT0OLkB29EX+GWzoZ6bfVPIVGYSM62z5wr4zy2ffAgRd 11C8Ady2JNKPK0Kw/WKWXsrdxDKs607kWCAsN8KHcF/y2KvyKSFg2dmAfjxwlveg ZA/RoVwBP6uViYM4XBB2ts688KGAnVN8MUGH+FEO0pbQXpDQAUu7ZGcfR5XaxkKU uNua2xZo+U9g76f2sLpinUND/b4KuTCLXXOgW6B3FeOBnnMkGSyrGqWscmeLL1I= =HNMn -----END PGP SIGNATURE-----
[toc] | [prev] | [next] | [standalone]
| From | Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> |
|---|---|
| Date | 2011-04-03 22:24 +0200 |
| Message-ID | <87d3l3krrl.fsf@merciadriluca-station.MERCIADRILUCA> |
| In reply to | #525 |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Aéris <aeris@imirhil.fr> writes: > Le 03/04/2011 21:33, Merciadri Luca a écrit : >> The >> problem is that some questions are asked on specific aspects of >> the Java language > > No, most of your questions is only in the OOP scope, not in the Java one. > Your questions can be applied on C# or Python instead of Java without > changing the responses, for example about inheritance, up/down-casting, > equals/identity, accessor scope and accessibility, etc. Okay, then. I learnt something new again. Well, I think that I'll read a lot these days about Java mechanisms, so that I will be able to give more interesting, precise and detailed questions. - -- Merciadri Luca See http://www.student.montefiore.ulg.ac.be/~merciadri/ - -- In the land of the blind, the one-eyed man is king. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/> iEYEARECAAYFAk2Y124ACgkQM0LLzLt8MhxiTwCgiqKg9IA6O3kxv4qC0C4tGBTY N0oAnRVxFomO3ZNIVRbnrws4w4oOOeTw =D82Z -----END PGP SIGNATURE-----
[toc] | [prev] | [next] | [standalone]
| From | Lew <noone@lewscanon.com> |
|---|---|
| Date | 2011-04-06 12:05 -0400 |
| Message-ID | <ini30p$30t$2@news.albasani.net> |
| In reply to | #500 |
Merciadri Luca wrote: > Thanks for the tips. I'll try to get a textbook. The problem is that > I'm learning Java for some course and that I don't have a sufficient > amount of (academic) time to learn Java in depth. So I'll try to do my best. Once again, Merciadri, <http://download.oracle.com/javase/tutorial/index.html> It's free. Did you miss this recommendation earlier? -- Lew Honi soit qui mal y pense. http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg
[toc] | [prev] | [next] | [standalone]
| From | Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> |
|---|---|
| Date | 2011-04-03 17:31 +0200 |
| Message-ID | <87zko7e4he.fsf@merciadriluca-station.MERCIADRILUCA> |
| In reply to | #498 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Eric Sosman <esosman@ieee-dot-org.invalid> writes:
> On 4/2/2011 4:13 PM, Merciadri Luca wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Hi,
>>
>> I'm given the following program snippet:
>>
>> ==
>> class C1
>> {
>> public int n;
>> }
>>
>> interface I1
>> {
>> int f();
>> }
>>
>> class C2 extends C1 implements I1
>> {
>> public int f()
>> {
>> n = 18;
>> }
>> }
>> ==
>> I need to say if the following expressions are valid or not
>> (justifications are trivial once I'm sure of the answer):
>>
>> 1. C1 obj_1 = new C2();
>
> Invalid.
>
>> 2. C2 obj_2 = new C1();
>
> Invalid.
>
>> 3. I1 obj_3 = new C2();
>
> Invalid.
>
>> 4. I1 obj_4 = new I1();
>
> Invalid.
>
>> 5. C2 obj_5 = new I1();
>
> Invalid.
> I predict you will get compile-time
> errors for all five of them.
Okay, I just tested and received the results I wrote before.
==
$ javac Test.java
Test.java:25: incompatible types
found : C1
required: C2
C2 obj_2 = new C1();
^
Test.java:27: I1 is abstract; cannot be instantiated
I1 obj_4 = new I1();
^
Test.java:28: I1 is abstract; cannot be instantiated
C2 obj_5 = new I1();
^
3 errors
==
so that the three operations I mentioned as invalid are effectively
(at least to my little knowledge) invalid.
Do you have an explanation about your way of reasoning? My compiler
might be too old, or something like that.
- --
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
- --
If you want to judge a man's character, give him power.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
iEYEARECAAYFAk2Yks0ACgkQM0LLzLt8MhwjcACeOCs6bQkzthbMsVrLLnh9U1pB
3KgAnjWe/2xDRT/2JX7WlbETaYUXh/oo
=3ml2
-----END PGP SIGNATURE-----
[toc] | [prev] | [next] | [standalone]
| From | Eric Sosman <esosman@ieee-dot-org.invalid> |
|---|---|
| Date | 2011-04-03 14:41 -0400 |
| Message-ID | <inaf05$rn0$1@dont-email.me> |
| In reply to | #502 |
On 4/3/2011 11:31 AM, Merciadri Luca wrote:
> Eric Sosman<esosman@ieee-dot-org.invalid> writes:
>> [...]
>> I predict you will get compile-time
>> errors for all five of them.
>
> Okay, I just tested and received the results I wrote before.
>[...]
> Do you have an explanation about your way of reasoning? My compiler
> might be too old, or something like that.
I think it less likely that your compiler is broken than that
you put the wrong code through it. Allow me to draw your attention
to method f() of class C2: What value does it return? (In the
version you posted, not the version you've been compiling.)
--
Eric Sosman
esosman@ieee-dot-org.invalid
[toc] | [prev] | [next] | [standalone]
| From | Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> |
|---|---|
| Date | 2011-04-03 21:45 +0200 |
| Message-ID | <87d3l3glvi.fsf@merciadriluca-station.MERCIADRILUCA> |
| In reply to | #519 |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Eric Sosman <esosman@ieee-dot-org.invalid> writes: > On 4/3/2011 11:31 AM, Merciadri Luca wrote: >> Eric Sosman<esosman@ieee-dot-org.invalid> writes: >>> [...] >>> I predict you will get compile-time >>> errors for all five of them. >> >> Okay, I just tested and received the results I wrote before. >>[...] >> Do you have an explanation about your way of reasoning? My compiler >> might be too old, or something like that. > > I think it less likely that your compiler is broken than that > you put the wrong code through it. Allow me to draw your attention > to method f() of class C2: What value does it return? (In the > version you posted, not the version you've been compiling.) It returns nothing, but as it is declared as an int method, it needs to return an int. Well, I added return n. What I sent over the valid and non valid instructions is effectively what I got by compiling the same code, but with a return where it was missing. I now understand your answer. I can't understand why people are sometimes so `picky' in some answers. This often go anti-pedagogical. That reminds me an oral exam. I had to prove some theorem on the board, wrote something like 98% of the proof, but forgot some things. Well, the proof was not complete, and the theorem was thus unproved, but is it a reason to say `totally erroneous?' Sure not, at least to me. It is better to say `well, you forgot some things.' Especially when the related mark is however high. This got many students completely frustrated, shocked, and unable to answer anymore at an oral. This is not what needs to be evaluated at an oral exam! Here, if I may, you answered correctly the question, but note that it brought me nothing interesting, simply because I did not understand your message, even if it was perfectly correct and irreproachable. Wouldn't it have been simpler, more pedagogic, and even `friendler,' to say `this way, there will be a problem with some method. Check it, because this is surely not the aim of this exercise.' You already knew that the aim of the exercise was to check student's knowledge about a totally different concept than a basic thing such as the fact that an int function needs to return an int, just as it would in C. And this is often an attitude I do not appreciate, since it brings nothing to the student, except some frustration. Going pedagogic is so much better, especially when it comes to help a student. - -- Merciadri Luca See http://www.student.montefiore.ulg.ac.be/~merciadri/ - -- Remember. If something can go wrong, it will. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/> iEYEARECAAYFAk2YzkEACgkQM0LLzLt8MhyY4QCfc/wcDl/W4T44Fv3vHtGtVVsr 0x0AoJNwgoJ9CFhch4tLeT18u06jmCxJ =zw6U -----END PGP SIGNATURE-----
[toc] | [prev] | [next] | [standalone]
| From | Eric Sosman <esosman@ieee-dot-org.invalid> |
|---|---|
| Date | 2011-04-03 16:40 -0400 |
| Message-ID | <inam0r$jj2$1@dont-email.me> |
| In reply to | #522 |
On 4/3/2011 3:45 PM, Merciadri Luca wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Eric Sosman<esosman@ieee-dot-org.invalid> writes:
>
>> On 4/3/2011 11:31 AM, Merciadri Luca wrote:
>>> Eric Sosman<esosman@ieee-dot-org.invalid> writes:
>>>> [...]
>>>> I predict you will get compile-time
>>>> errors for all five of them.
>>>
>>> Okay, I just tested and received the results I wrote before.
>>> [...]
>>> Do you have an explanation about your way of reasoning? My compiler
>>> might be too old, or something like that.
>>
>> I think it less likely that your compiler is broken than that
>> you put the wrong code through it. Allow me to draw your attention
>> to method f() of class C2: What value does it return? (In the
>> version you posted, not the version you've been compiling.)
>
> It returns nothing, but as it is declared as an int method, it needs
> to return an int. Well, I added return n. What I sent over the valid
> and non valid instructions is effectively what I got by compiling the
> same code, but with a return where it was missing.
>
> I now understand your
> answer. I can't understand why people are sometimes so `picky' in some
> answers. This often go anti-pedagogical.
If you pose a question that requires the answerer to imagine
some kind of repair or completion, different answerers are likely to
imagine different completions and may therefore give different
answers. One reader fleshes out your code *this* way and says "Yes,"
another completes it *that* way and says "No." Who's right? Both!
What have you learned, having been told both "Yes" and "No?" Nothing!
If you dislike pickiness, get out of programming. Seriously. The
computer is far, far pickier than any human can be.
> That reminds me an oral exam. I had to prove some theorem on the board, wrote
> something like 98% of the proof, but forgot some things. Well, the
> proof was not complete, and the theorem was thus unproved, but is it a
> reason to say `totally erroneous?' Sure not, at least to me. It is
> better to say `well, you forgot some things.' Especially when the
> related mark is however high. This got many students completely
> frustrated, shocked, and unable to answer anymore at an oral. This is
> not what needs to be evaluated at an oral exam!
Writing on a blackboard and waving your hands and operating the
smoke-and-mirrors machine for a human audience is one thing; writing
code and giving it to a completely unimaginative compiler is another.
If you think you can write 98% of a program and have it work, you are
in the wrong line of work altogether.
(Also, I did not use the phrase "totally erroneous." I called
your code "a half-remembered half-accurate half-assed approximation."
I'm not sure "totally erroneous" is even possible, since there does
not seem to be an upper bound on error: Any program, however bad, can
always be disimproved -- or so I suspect.)
> Here, if I may, you answered correctly the question, but note that it
> brought me nothing interesting, simply because I did not understand
> your message, even if it was perfectly correct and irreproachable.
That's because you're lazy. Or inattentive. Or both.
> Wouldn't it have been simpler, more pedagogic, and even `friendler,'
> to say `this way, there will be a problem with some method. Check it,
> because this is surely not the aim of this exercise.'
Have you heard about giving a man a fish versus teaching him to
fish? Here's the point: You have questions about Code Sample A, and
you show us Code Sample B instead. Therefore you get wrong answers.
My pedagogic purpose was to teach you the folly of pretending A == B.
I claim that my purpose has been achieved: You have been taught the
lesson, even though you clearly resent learning it.
Besides, you have already told us that you do not wish to learn
Java "in depth," so why complain about shallow answers? It's odd for
an admitted non-learner to harp on pedagogy.
--
Eric Sosman
esosman@ieee-dot-org.invalid
[toc] | [prev] | [next] | [standalone]
| From | Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> |
|---|---|
| Date | 2011-04-03 22:58 +0200 |
| Message-ID | <87y63rxdb5.fsf@merciadriluca-station.MERCIADRILUCA> |
| In reply to | #529 |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Eric Sosman <esosman@ieee-dot-org.invalid> writes: > On 4/3/2011 3:45 PM, Merciadri Luca wrote: >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> Eric Sosman<esosman@ieee-dot-org.invalid> writes: >> >>> On 4/3/2011 11:31 AM, Merciadri Luca wrote: >>>> Eric Sosman<esosman@ieee-dot-org.invalid> writes: >>>>> [...] >>>>> I predict you will get compile-time >>>>> errors for all five of them. >>>> >>>> Okay, I just tested and received the results I wrote before. >>>> [...] >>>> Do you have an explanation about your way of reasoning? My compiler >>>> might be too old, or something like that. >>> >>> I think it less likely that your compiler is broken than that >>> you put the wrong code through it. Allow me to draw your attention >>> to method f() of class C2: What value does it return? (In the >>> version you posted, not the version you've been compiling.) >> >> It returns nothing, but as it is declared as an int method, it needs >> to return an int. Well, I added return n. What I sent over the valid >> and non valid instructions is effectively what I got by compiling the >> same code, but with a return where it was missing. >> >> I now understand your >> answer. I can't understand why people are sometimes so `picky' in some >> answers. This often go anti-pedagogical. > > If you pose a question that requires the answerer to imagine > some kind of repair or completion, different answerers are likely to > imagine different completions and may therefore give different > answers. One reader fleshes out your code *this* way and says "Yes," > another completes it *that* way and says "No." Who's right? Both! > What have you learned, having been told both "Yes" and "No?" Nothing! > > If you dislike pickiness, get out of programming. Seriously. The > computer is far, far pickier than any human can be. > >> That reminds me an oral exam. I had to prove some theorem on the board, wrote >> something like 98% of the proof, but forgot some things. Well, the >> proof was not complete, and the theorem was thus unproved, but is it a >> reason to say `totally erroneous?' Sure not, at least to me. It is >> better to say `well, you forgot some things.' Especially when the >> related mark is however high. This got many students completely >> frustrated, shocked, and unable to answer anymore at an oral. This is >> not what needs to be evaluated at an oral exam! > > Writing on a blackboard and waving your hands and operating the > smoke-and-mirrors machine for a human audience is one thing; writing > code and giving it to a completely unimaginative compiler is another. > If you think you can write 98% of a program and have it work, you are > in the wrong line of work altogether. > > (Also, I did not use the phrase "totally erroneous." I called > your code "a half-remembered half-accurate half-assed approximation." > I'm not sure "totally erroneous" is even possible, since there does > not seem to be an upper bound on error: Any program, however bad, can > always be disimproved -- or so I suspect.) > >> Here, if I may, you answered correctly the question, but note that it >> brought me nothing interesting, simply because I did not understand >> your message, even if it was perfectly correct and irreproachable. > > That's because you're lazy. Or inattentive. Or both. > >> Wouldn't it have been simpler, more pedagogic, and even `friendler,' >> to say `this way, there will be a problem with some method. Check it, >> because this is surely not the aim of this exercise.' > > Have you heard about giving a man a fish versus teaching him to > fish? Here's the point: You have questions about Code Sample A, and > you show us Code Sample B instead. Therefore you get wrong answers. > My pedagogic purpose was to teach you the folly of pretending A == B. > I claim that my purpose has been achieved: You have been taught the > lesson, even though you clearly resent learning it. > > Besides, you have already told us that you do not wish to learn > Java "in depth," so why complain about shallow answers? It's odd for > an admitted non-learner to harp on pedagogy. Everybody wants to learn everything in depth. The fact is that there are far more important things in my studies now. As a result, I want to learn the basic and most important things in Java. I wrote a project for the course, but it did not give me sufficient knowledge about Java. Well, I can do many things, but I haven't yet the habit, and it will take some time. Programming is clearly something that is honed by years of practice. All the best, - -- Merciadri Luca See http://www.student.montefiore.ulg.ac.be/~merciadri/ - -- It's the early bird that gets the worm. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/> iEYEARECAAYFAk2Y310ACgkQM0LLzLt8Mhx5WQCgrC7mhzSPhLTqqyXtihbYJZra gAoAn2/4OJ7CEAmlvzht/GfWOVzky96A =M3/b -----END PGP SIGNATURE-----
[toc] | [prev] | [next] | [standalone]
| From | Lew <noone@lewscanon.com> |
|---|---|
| Date | 2011-04-06 12:13 -0400 |
| Message-ID | <ini3g3$4mc$1@news.albasani.net> |
| In reply to | #530 |
Merciadri Luca wrote: > Everybody wants to learn everything in depth. The fact is that there And some people are actually willing to study to do that. > are far more important things in my studies now. As a result, I want Well, then, there are far more important things for us to do than enable an ungrateful person who asks for advice then argues about it. How arrogant can you be? You even make me look humble. > to learn the basic and most important things in Java. I wrote a That's a flat-out lie. You obviously want no such thing. Otherwise you'd actually take the advice for which you ask,and you wouldn't be so proudly, arrogantly lazy about it. > project for the course, but it did not give me sufficient knowledge > about Java. Well, I can do many things, but I haven't yet the habit, > and it will take some time. Programming is clearly something that is > honed by years of practice. And yet you won't spend minutes on it. You're wasting everyone's time, most especially your own. Is that really wise? -- Lew Honi soit qui mal y pense. http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg
[toc] | [prev] | [next] | [standalone]
| From | Lew <noone@lewscanon.com> |
|---|---|
| Date | 2011-04-06 12:10 -0400 |
| Message-ID | <ini38q$30t$4@news.albasani.net> |
| In reply to | #522 |
Merciadri Luca wrote: >I can't understand why people are sometimes so `picky' in some > answers. This often go anti-pedagogical. Because you ignore advice previously given, you don't do your own research, you don't seem to do any work on your own, and you get mad at the answers. It's really not complicated. -- Lew Honi soit qui mal y pense. http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg
[toc] | [prev] | [next] | [standalone]
| From | Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> |
|---|---|
| Date | 2011-04-03 21:51 +0200 |
| Message-ID | <878vvrgll9.fsf@merciadriluca-station.MERCIADRILUCA> |
| In reply to | #519 |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 And `going pedagogic' does not mean `doing others' homeworks.' That just means pointing what is the most probable source of mistakes. But I understood the error, and also my mistake. Now, we might agree on the valid and invalid instructions. Precision is important in programming, mathematics, and, more generally, in every science, but nothing is more important than a constructive discussion, or relationship. All the best, - -- Merciadri Luca See http://www.student.montefiore.ulg.ac.be/~merciadri/ - -- If you don't buy a ticket, you can't win the raffle. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/> iEYEARECAAYFAk2Yz7IACgkQM0LLzLt8MhyNlwCgro66nx4WVF2kC5wCRj3W9Chg rHwAn2SB9W6KqSQMDb7ba8cvPFM9TQRH =xTXo -----END PGP SIGNATURE-----
[toc] | [prev] | [next] | [standalone]
| From | Patricia Shanahan <pats@acm.org> |
|---|---|
| Date | 2011-04-03 13:02 -0700 |
| Message-ID | <QqCdnQmtcq3DTwXQnZ2dnUVZ_jidnZ2d@earthlink.com> |
| In reply to | #523 |
On 4/3/2011 12:51 PM, Merciadri Luca wrote: ... > Precision is important in programming, mathematics, and, more > generally, in every science, but nothing is more important > than a constructive discussion, or relationship. When the subject of the discussion is programming or mathematics, often precision is necessary for a constructive discussion. The less familiar someone is with a programming language, the greater the risk that something really important, that affects answers to their questions, seems like an irrelevant detail to them. Patricia
[toc] | [prev] | [next] | [standalone]
| From | Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> |
|---|---|
| Date | 2011-04-03 22:23 +0200 |
| Message-ID | <87hbafkrtg.fsf@merciadriluca-station.MERCIADRILUCA> |
| In reply to | #524 |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Patricia Shanahan <pats@acm.org> writes: > On 4/3/2011 12:51 PM, Merciadri Luca wrote: > ... >> Precision is important in programming, mathematics, and, more >> generally, in every science, but nothing is more important >> than a constructive discussion, or relationship. > > When the subject of the discussion is programming or mathematics, often > precision is necessary for a constructive discussion. The less familiar > someone is with a programming language, the greater the risk that > something really important, that affects answers to their questions, > seems like an irrelevant detail to them. Sure, but that does not mean, to me, that the way he answered was the right way to make me understand what was the error. But that is only a point of view. It is possible to answer precisely and pedagogically. - -- Merciadri Luca See http://www.student.montefiore.ulg.ac.be/~merciadri/ - -- If you want to judge a man's character, give him power. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/> iEYEARECAAYFAk2Y1ysACgkQM0LLzLt8Mhy09QCgnjfMgdNFj57S2ZtOF2ACl12j MqcAmwfQ9x5fKy3ZgGktLFQnlBjlcARi =dLEE -----END PGP SIGNATURE-----
[toc] | [prev] | [next] | [standalone]
| From | Lew <noone@lewscanon.com> |
|---|---|
| Date | 2011-04-06 12:15 -0400 |
| Message-ID | <ini3jc$4mc$2@news.albasani.net> |
| In reply to | #523 |
Merciadri Luca wrote: > Precision is important in programming, mathematics, and, more > generally, in every science, but nothing is more important > than a constructive discussion, or relationship. Yet you do nothing to build one. That's hypocritical. -- Lew Honi soit qui mal y pense. http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg
[toc] | [prev] | [next] | [standalone]
| From | Lew <noone@lewscanon.com> |
|---|---|
| Date | 2011-04-06 12:08 -0400 |
| Message-ID | <ini35r$30t$3@news.albasani.net> |
| In reply to | #502 |
On 04/03/2011 11:31 AM, Merciadri Luca wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Eric Sosman<esosman@ieee-dot-org.invalid> writes:
>
>> On 4/2/2011 4:13 PM, Merciadri Luca wrote:
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA1
>>>
>>> Hi,
>>>
>>> I'm given the following program snippet:
>>>
>>> ==
>>> class C1
>>> {
>>> public int n;
>>> }
>>>
>>> interface I1
>>> {
>>> int f();
>>> }
>>>
>>> class C2 extends C1 implements I1
>>> {
>>> public int f()
>>> {
>>> n = 18;
>>> }
>>> }
>>> ==
>>> I need to say if the following expressions are valid or not
>>> (justifications are trivial once I'm sure of the answer):
>>>
>>> 1. C1 obj_1 = new C2();
>>
>> Invalid.
>>
>>> 2. C2 obj_2 = new C1();
>>
>> Invalid.
>>
>>> 3. I1 obj_3 = new C2();
>>
>> Invalid.
>>
>>> 4. I1 obj_4 = new I1();
>>
>> Invalid.
>>
>>> 5. C2 obj_5 = new I1();
>>
>> Invalid.
>> I predict you will get compile-time
>> errors for all five of them.
>
> Okay, I just tested and received the results I wrote before.
>
> ==
> $ javac Test.java
> Test.java:25: incompatible types
> found : C1
> required: C2
> C2 obj_2 = new C1();
> ^
> Test.java:27: I1 is abstract; cannot be instantiated
> I1 obj_4 = new I1();
> ^
> Test.java:28: I1 is abstract; cannot be instantiated
> C2 obj_5 = new I1();
> ^
> 3 errors
> ==
> so that the three operations I mentioned as invalid are effectively
> (at least to my little knowledge) invalid.
>
> Do you have an explanation about your way of reasoning? My compiler
> might be too old, or something like that.
This question was answered in your first answer:
> Which expressions put a subtype instance into a supertype variable?
>
> Which expressions put a supertype instance into a subtype variable?
>
> How can a subtype variable be sure that a supertype instance is of the correct type?
>
> Are you allowed in Java to instantiate an interface?
>
> Please answer as best you can. You should use the Java tutorials to help you; don't just randomly guess. We will be expecting your responses.
Did you even engage with those hints? If not, why expect more?
--
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | comp.lang.java.help
csiph-web