Rob Sweeny

Greenhorn
+ Follow
since Jan 14, 2010
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 Rob Sweeny

Simple question: Java SE 5 ? Java SE 6?

Thanks
Rob
14 years ago
Thanks everyone.
Looks like it's time to buy a new book!
14 years ago
Hi All,

I've been able to compile my supporting class file FloatNumber, but not my main class, MainFloatNumber.

CODE:





DIRECTORY HIERARCHY:

C:\code\src\com\scjaexam\tutorial
C:\code\src\com\scjaexam\tutorial\floatnumbers
C:\code\classes\com\scjaexam\tutorial
C:\code\classes\com\scjaexam\tutorial\floatnumbers

JAVAC:

c:\code>javac -d classes c:\code\src\com\scjaexam\tutorial\floatnumbers\FloatNumber.java
___compiles, and puts class file in correct location
___C:\code\classes\com\scjaexam\tutorial\floatnumbers\FloatNumber.class

c:\code>javac -d classes -cp classes c:\code\src\com\scjaexam\tutorial\MainFloatNumber.java

c:\code\src\com\scjaexam\tutorial\MainFloatNumber.java:7: cannot find symbol
symbol : method FloatNumber(float)
location: class com.scjaexam.tutorial.MainFloatNumber
FloatNumber value = FloatNumber(1f);


Any help would be appreciated.
Rob
14 years ago
I got them from "Sun Certified Java Associate Study Guide" by Liguori and Finegen.

more context from the book:

"When you design Java packages, such as grouping of classes, the following key areas should be concidered:"

Package Attribute - Benfits of Applying the Package Attribute

Class Coupling - Package dependencies are reduced with class coupling
System Coupling - Package dependencies are reduced with system coupling
Package Size - Typically, larger packages support reusabilty, whereas smaller
------------------packages support maintainabilty.
Maintainability - Often, software changes can be limited to a single package when
-------------------the package houses focused functionality
Naming - Consider conventions when naming packages. Use reverse domain
-----------name for package structure. Use lowercase characters delimted with
-----------underscores to seperate words in package names

Hope this helps
14 years ago
Is this the appropriate forum for this question?

If not, is there a way to 'move' it to another? Or do i have to repost it?

Thanks
Rob

14 years ago
Hi All,

I am using a book to study for the exam and it says the following: :

Common packages you will see on the exam are packages for
Java Abstrat Window Toolkit API
Java Swing API
Java Basic Input/Output API
Java Networking API
Java Utilities API
core Java Language API.

You will need to know the basic functionality that each package/api contains.

1) Is that the correct list of packages ?
2) what is "the basic functionality that each package contains" ?

Thanks
Rob
14 years ago
Hi All,

Here's what I understand about Package Design:

Packages are like containers for classes
they define where classes are located in the hierarchical directory structure
and also promote code reuse, maintainability , encapsulation (on a grand scale), and modularity.

What I dont' get are the following two statements:

Package dependencies are reduced with Class coupling.
Package dependencies are reduced with System coupling.

What is Class Coupling and System Coupling?

Thanks, Rob
14 years ago
On this topic:

What is the correct anotation to send in multiple command line args?

Would it be like this: java SkipLine -Hello -World
14 years ago
How do i "explicity cast all of your additions to byte" ?



Doesn't work.
14 years ago
Hi All,

I've Included two source files that I would think would do the same thing, but they dont

Using Compound Assignment Operators I have no compilation errors.
But when I convert the code to strict Assignment Operators I get "Possible Loss of Precision"

1. How do I change the 2nd source code so it doesn't give me these errors
2. Why is there a difference. Why doesn't the Compound Assignment Operators give me the same errors.


No Compilation Errors:



Compliation Errors:



Compilation Error:

src\com\scjaexam\tutorial\pirates\AssignmentOperators.java:11: possible loss of
precision
found : int
required: byte
_________System.out.println(a = a + 3); // 13
_____________________________^


Thanks!
14 years ago
Hi All,

How do I populate an ArrayList of Floats?
The below code gives me errors on compilation.





c:\code>javac LegalKeeperFish.java
LegalKeeperFish.java:7: cannot find symbol
symbol : method add(double)
location: class java.util.ArrayList<java.lang.Float>
___________ fishLengthList.add(10.0);
______________________^

Thanks

p.s. Is this the correct forum for a question like this?
14 years ago
Hi All,

I am trying to set up a meaningful directury structure to house my source and class files
and finally use javac to compile my .java files into class files.

As a noob I'm having problems doing so.

javac can't find my main class GreetingsUniverse.java

This is what I have so far:

C:\java\classes\com\scjaexam\tutorial\planets
C:\java\src\com\scjaexam\tutorial\planets

C:\java\src\com\scjaexam\tutorial\GreetingsUniverse.java



C:\java\src\com\scjaexam\tutorial\planets\Earth.java




c:\java>javac -classpath classes -sourcepath src GrettingsUniverse.java
javac: file not found: GrettingsUniverse.java

c:\java>javac -classpath classes -sourcepath c:\src GrettingsUniverse.java
javac: file not found: GrettingsUniverse.java

c:\java>javac -classpath classes -sourcepath "c:\src" GrettingsUniverse.java
javac: file not found: GrettingsUniverse.java

c:\java>javac -classpath classes -sourcepath "C:\java\src\com\scjaexam\tutorial" GrettingsUniverse.java
javac: file not found: GrettingsUniverse.java


I was able to compile and interpret the code successfully when all files where in the same dir without using the package or imports statements.
14 years ago

And welcome to JavaRanch



Happy to be here.

i found the problem.


Original code:



created <identifier> expected error

Fixed Code:



the identifier that was expected was () to make this code into a proper constructor.

Thanks Everyone
14 years ago
Thanks for the quick responses!

Now I have the same error on a different line

Could it have something to do with packaging?


Main Class: GreetingsUniverse



Other Class: Earth



c:\code>javac GreetingsUniverse.java
.\com\scjaexam\tutorial\Earth.java:4: <identifier> expected
System.out.println("Hello from Earth");
______________^

14 years ago
Main Class: GreetingsUniverse



Other Class: Earth



javac GreetingsUniverse.java

results in:

.\com\scjaexam\tutorial\Earth.java:4: <identifier> expected
public Earth {
_________^


Any help would be greatly appreciated.
Thanks
Rob
14 years ago