About question com.enthuware.ets.scjp.v6._2_.612

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
jbprek
Posts: 4
Joined: Sat Aug 30, 2014 4:19 am
Contact:

About question com.enthuware.ets.scjp.v6._2_.612

Post by jbprek »

I don't think that is "Tough".
Last edited by admin on Mon Oct 13, 2014 10:46 am, edited 1 time in total.
Reason: Scrambled qid

piotrkmiotczyk
Posts: 27
Joined: Mon Sep 22, 2014 1:30 pm
Contact:

Re: About question com.enthuware.ets.scjp.v6.2.612

Post by piotrkmiotczyk »

So in your question, to use Stock.class defined in com.enthu.rad package, I have to:
package com.enthu.rad;
...(place 'myself' in the same package)

Or I would have to, if I could, change:
import com.enthu.rad.*;
...to
import com.enthu.rad;
...because, as the solution reads: 'A package statement can never have a *. It should specify the exact package name'.
-------------------------------------------------------
Now, I have made a test package and:
import java.awt.event;
..does not compile, despite being 'exact package name', compiler is looking for a class name)
import java.awt.event.*;
...(import all classes in the package) works fine.

In other words, my test seems to suggest just the opposite. How come?

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About question com.enthuware.ets.scjp.v6.2.612

Post by admin »

Please post the exact code that you have a problem compiling.

The explanation says, "A package statement can never have a *. It should specify the exact package name", which is correct.
You are doing, "import java.awt.event;" This is not a package statement. This is an import statement. import statement should either end with a class name or with a *.

piotrkmiotczyk
Posts: 27
Joined: Mon Sep 22, 2014 1:30 pm
Contact:

Re: About question com.enthuware.ets.scjp.v6.2.612

Post by piotrkmiotczyk »

You are completely right, I just kept overlooking the keyword. Had there been
import com.enthu.rad.*; (not: package com.enthu.rad.*;)
..in the first option, what I said would've made sense. Thanks.

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests