Why can't I use a double to point to a place in an array?
Sorry if this is a stupid question, but whenever I compile code like this I get this error message:
QuickTest.java:16: possible loss of precision
found : double
required: int
System.out.println(s[t]);
I would use an int, but My array that I want to use in other code is 1000 places big. What am I doing wrong?
public class QuickTest{
static String[] s = new String[200];
public static void main (String[] args) {
s[0] ="Why";
s[1] ="do";
s[2] ="you";
s[3] ="own";
s[4] ="ten";
s[5] ="Red";
s[6] ="white";
s[7] ="and";
s[8] ="blue";
s[9] ="hats";
double t = 2;
System.out.println(s[t]);
}
I'm confused, I thought an int only went up to 255 (or something around that).Confused, indeed. You thought wrong.
You only need 8 bits to represent an unsigned 0-255. An int is 32 bits. Better go get a good Java book and read up.
%
Similar Messages
-
Why can't i use the double-tap feature on my inspire 4g
okay on certain websites like www.tchek.com
it doesn't let me log in and enter my stuff in the field like i am now in this post question box. and i cant click on anything and i can zoom in or out. this website work great on Atrix. i got this phone just for this web site. i also tryed beta but no help same problem. please help.Do you have an account on the site? Looking at the basic form on the home page I am able to type in all the fields.
-
I tried to customize the Envy 15t but I can't proceed on upgrading the following.
Error
24GB SSD Acceleration Cache requires purchase only up to 8GB System Memory.
Why can't I use the 16GB DDR3 System Memory (2 Dimm) with 24GB flash Hard Drive Acceleration Cache?
Can HP explain this to me? or any one? pleaseHi,
The 24Gb cache drive will store manything and normally it will need at least twice the size (capacity) of RAM. Double 16Gb is 32Gb therefore 24Gb is not big enough.
Regards.
BH
**Click the KUDOS thumb up on the left to say 'Thanks'**
Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem. -
Why can't i use trial version to convert files to word?
Why can't i use trial version to convert files to word?
Symptom: I downloaded the trial of Acrobat Pro. But when I try to create a PDF or export a PDF, by using the Convert or Export button, I am asked to subscribe.
Cause: You are mixing up two different products. Adobe Reader is the free PDF reader you had before and still have. Acrobat Pro is a DIFFERENT product and doesn't even have the Convert or Export buttons you are using (so, we can tell for sure you aren't actually using the demo you downloaded).
Solution: quit Adobe Reader. Start Acrobat Pro (from START in Windows, or from Applications on Mac OS). You will see a product similar to Adobe Reader but able to do much more. Open PDF files with File > Open, NOT a double click. To export to other formats, use File > Save as... various options. -
Why can I not use mobile link in reader on window Vista?
Why can I not use mobile link in reader on window Vista?
Hi sze wing,
Please tell us a bit more--what do you mean by "cannot use"? Do you get an error message? Or are files not syncing as you expect?
Have you double-checked to make sure that Mobile Link is on? Please see Acrobat Help | Mobile Link: open once, read anywhere for instructions on enabling Mobile Link, if it isn't already enabled.
If it is enabled, and things still aren't working as expected, please let us know what issue you're facing, including any error messages.
Best,
Sara
[discussion moved to Adobe Reader forum] -
Hi, my MacBook Air is not working anymore if it's not connected with the power cable. It's pretty new so I can't imagine that the battery is dead already. Why can't I use my MacBook Air without the power cable even though I charged it for hours?
Please take the Mac to Apple store to have it checked out.
Genius Bar reservation
http://www.apple.com/retail/geniusbar/
Best. -
Why can't I use my mid 2010 macbook pro with 8GB memoir and NVIDIA GEForce GT 330M 256MB to run 3D in photoshop CC?
3-D is very memory intensive.
System requirements | Photoshop
Mac OS
Multicore Intel processor with 64-bit support
Mac OS X v10.7, v10.8, or v10.9
2 GB of RAM (8 GB recommended)
3.2 GB of available hard-disk space for installation; additional free space required during installation (cannot install on a volume that uses a case-sensitive file system or on removable flash storage devices)
1024x768 display (1280x800 recommended) with 16-bit color and 512 MB of VRAM (1 GB recommended)**
OpenGL 2.0–capable system
Internet connection and registration are necessary for required software activation, membership validation, and access to online services.*
** 3D features are disabled and some Mercury Graphics Engine enhanced features may not work with less than 512 MB VRAM. Read the Help article.
Bottom line, you don't have enough VRAM
Nancy O. -
Why can't we use iTunes gift cards with family sharing? After Christmas, we now have lots of account credit we can't use. Very frustrating. There is no option found for using account credit.
I just logged out of my daughter's account and back in, and now it works. Deducted from gift card account balance. So I hope this is resolved.
-
HT4061 Why can't I use face time on 3G internet
Why can't I use FaceTime on 3G internt
This feature will only be available when the new update ios6 comes out in sept or october and will only be for the iphone 4s or the new ipad if havent got one of these devices then facetime will only work over wifi the reason apparently the older devices are unable to handle it requires more processing power.
-
Hi, why can't I use the iMessage on my iPhone? I've already had my apple id email on it but it keeps saying "waiting for activation" always like that. No progress. Could anybody help me on this? Cheers
I have an old iPod Touch with old software that can no longer be updated:
iOS version 6.1.6
I've been searching for a solution to my iMessage login problem for months and tried everything from those frustrating links and all the tips from other users.
Here is what finally worked:
1) Settings > Privacy > Location Services > On
2) Settings > General > Date & Time > Set Automatically > On
3) Reboot device until Apple logo appears
4) Settings > Messages > Sign In -
Why can't i use my visa on my iphone ?
why can't i use my visa card?
I dont know? what happens when you try? visa is an acceptable payment method.
-
Why can't I use the Emoji keyboard on my IPad Air?
u need to set up 1st the Emoji keyboard. How ?
setting>keyboard>keyboards>Add new keyboard>select Emoji -
Why can't i use credit card on app store its money on it and its an visa card
why can't i use credit card on app store its money on it and its an visa card
Credit cards do need to be from the same country as your account, which may or may not apple, but if you're visiting from another country and trying to use, for example, a UK card in the US app store, it won't work.
Could you have typo'd a number? Or could the card be expired?
http://support.apple.com/kb/HT5552
has more info on what's accepted.
Is this a visa gift card? I seem to recall people having issues with credit card gift cards. -
Why can't I use a backslash on my Iphone when entering my email address
Why can't I use a backslash on my Iphone when entering my email address
Best thing to do is go to your email, hit reply on any email and find the backslash on your keyboard. Select the Backslash and then cut/copy it into your mail settings or wherever you want to use it.
-
Why can't I use face time on iPad 2 with 3g iOS 6.0.1
why can't I use face time on ipad2 with 3g and ios 6.0.1
Using FaceTime http://support.apple.com/kb/ht4319
Troubleshooting FaceTime http://support.apple.com/kb/TS3367
The Complete Guide to FaceTime + iMessage: Setup, Use, and Troubleshooting
http://tinyurl.com/a7odey8
Troubleshooting FaceTime and iMessage activation
http://support.apple.com/kb/TS4268
Using FaceTime and iMessage behind a firewall
http://support.apple.com/kb/HT4245
iOS: About Messages
http://support.apple.com/kb/HT3529
Set up iMessage
http://www.apple.com/ca/ios/messages/
Troubleshooting Messages
http://support.apple.com/kb/TS2755
Setting Up Multiple iOS Devices for iMessage and Facetime
http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l
FaceTime and iMessage not accepting Apple ID password
http://www.ilounge.com/index.php/articles/comments/facetime-and-imessage-not-acc epting-apple-id-password/
Unable to use FaceTime and iMessage with my apple ID
https://discussions.apple.com/thread/4649373?tstart=90
Cheers, Tom
Maybe you are looking for
-
11.1.3 crashes when importing an mp3 file from hard drive
When I try to 'add file' from my hard drive to iTunes 11.1.3 the program crashes. The file is not added. Until updating to 11.1.3 I could add one or more files with no problem. Windows 7. Is this a glitch in the update or specific to my machine and
-
Problem in using a structure with a field of data type 'RAW STRING'
Friends I have written a ZBAPI that imports a structure which has 5 fields. I have defined this in the IMPORT tab of Tr.Code <SE37>. One of the field of this structure is of data type 'RAW STRING'. When I try to activate this BAPI, I get an error me
-
How to install BMC performance manager?
Please help give some tips, links and share experience. Thanks a lot!
-
Can't Export project from Final Cut 10.1.2
I have just spent hours working on a project for work. The time to export has come, but every time I try and export- Nothing Happens. No Errors, no rendering, Nothing. Does any one have a fix for this? Thanks in Advance,
-
I'm using MAX test panel to test my digital I/O pins, however i couldn't find any manual explaining the function of the test panel. there are 2 tab on DIO. what are the operation/function in the 2 DIO tab? First Digital IO tab a. which port does it t