Abid Ramay

Ranch Hand
+ Follow
since Apr 06, 2013
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Abid Ramay

thanks for help
5 years ago
according to SCJA book =>

To view the source of the Java SE source files directly, either download the
source code off the Internet or visit JDocs at http://www.jdocs.com/. JDocs
provides an interface to the source code of several Java-based projects,
including the Java platform, Standard Edition.

when i checked the linkwebpage, it came empty - searched for java.lang http://www.jdocs.com/harmony/5.M5/java/util/package-summary.html

did i miss something on this ??

thanks for your help
5 years ago
yes i realize that now

statement -> if (on == true) will result a boolean and cannot be compared to an 'int'

(Y. Daniel Liang-> intro to java programming - pg- 90 ) has good explanantion on the topic
5 years ago

ok .. i figured it out .. thanks to you guyz

1) i changed if statement ->

if (on == true)

ealier i was using assignment operator which changed the value to


instead of comparing it .

2) i changed

if (( volume == 1) && (volume == 100))

with brackets which works more appropriately.

3) now the results are as expected.
5 years ago

when i call this methods changeVolume tv2.setChannel(10);

it produces '0' output despite passing any value...

thanks for your help
5 years ago
i more question - what about my constructor

then i used int newChannel again for method setChannel

do you find this good programming practice or can it be improved ?

5 years ago

Joel Christophel wrote:Look at your brackets for your getChannel() method. The first one is misplaced.

Also, your switchTvOn() method has some problems.
1. It's return type is int, but you're returning a boolean.
2. Why isn't the return type void? You're not getting the TV's state, you're setting it.
3. Calling switchTvOn(false) should turn the TV off, and switchTvOn(true) should turn it on, but you're just setting things to true.
4. Also, you have two on variables, a local method variable and a state variable. When you do on = true; you're setting the local variable to true instead of the state variable.

Here's how switchTvOn() should look:

In the above, this.on refers to the on state variable at the top of your class, and on refers to the local on variable that was passed in to the method. All you're doing is setting the your TV on or off, depending on whatever boolean value the user passes in.

One more thing:
You should read up on access modifiers. Basically, classes, class variables, methods, and more can all be labeled with an access modifier (e.g. public, private, protected). When using ClassA from ClassB, ClassA's access modifiers will either block or allow the visibility of its various components. As a rule of thumb for now:
1. Classes should be public (e.g. public class Tester{})
2. If methods and variables are only to be used within the class they're declared in, make them private.
3. If methods and variables are to be used from other classes, make them public.



1) thanks for the tip. i new i made a silly mistake like {} not using properly


in this i was experimenting, i get your message loud and clear.

3) again, thanks for the link - (acces modifier)
5 years ago

hi all - i am working on this code. my method getChannel is giving an error

Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method getChannel() is undefined for the type TV

at TestTV.main(TestTV.java:18)

please help.
5 years ago
@Charles D. Ward - the mistake is corrected .. i am seeing this abnormal behaviour .. it's gives you an error and if i type it again .. it goes away.

5 years ago
hi again

actually its still the same .. sorry for confusion

5 years ago
@Winston Gutkowski -- ahh cool man, i just made a fool out of myself ;P

5 years ago

hi all

have started working on classes, i have these two classes in two seperate files -

when initialize the instance of class "mybox.width=30;" - it says 'width cannot be resolved or is not a files'
i am using eclipse, everything works fine in note pad... thanks for your help
5 years ago
ok thank you guyz. you all have been very helpfull.
5 years ago
yes agreed .. but my theory makes sense .. in terms of complexity compared to PC
5 years ago
one more things .. my interest in arduino is because i want to gain a better understanding of computer architecture . e.g. RISC architecture etc

my thoery is, learning on this platform will eliminate the complexities of PC e.g. no operating system . No HDD . No RAM .. ok there is RAM in arduino, given its small scale - it is not complex at all ..

please correct if i am wrong .. !!

5 years ago