Getting a "Return" error message when compiling
I have the following code below that works when I don't use any methods.
When I insert the side method(), I always get an error message "missing return statement".
I can't figure out what I am doing wrong.
It runs fine as it is but I am trying to modify it by using separate methods (just to learn how to use and call methods).
I am trying to replace what I have in the main method in separate method called "side".
Here is the code
import javax.swing.*;
public class Round
private String output = "";
//message error occurs when this method is added;
public String side()
for (int row = 1; row <=5 ; row ++)
if (row == 1 || row == 5)
return output += " * * \n";
public static void main(String args[])
String output = "";
//the for loop (before the else) is copied into the side method.
for (int row = 1; row <=5 ; row ++)
if (row == 1 || row == 5)
output += " * * \n";
else
if (row == 2 || row ==4)
output += " * * \n";
else
output += "* *\n";
JOptionPane.showMessageDialog(null,output);
System.exit(0);
}Thanks for your help.
I did as you suggested and still get the same results.
I also tried using on one return statement after the for loop but still got an error message.
Do you know how I can fix this?
thanks
public String side()
for (int row = 1; row <=5 ; row ++)
if (row == 1 || row == 5)
return output += " * * \n";
else
if (row == 2 || row ==4)
return output += " * * \n";
else
return output += "* *\n";
[\code]
Similar Messages
-
I am trying to sync to Outlook 2010. I get a weird error message when I am trying to setup on my pc. Its not english. It says "der automatische refresh konnte nicht gestartet werden" Help!
Hello,
'''Try Firefox Safe Mode''' to see if the problem goes away. Safe Mode is a troubleshooting mode, which disables most add-ons.
''(If you're not using it, switch to the Default theme.)''
* On Windows you can open Firefox 4.0+ in Safe Mode by holding the '''Shift''' key when you open the Firefox desktop or Start menu shortcut.
* On Mac you can open Firefox 4.0+ in Safe Mode by holding the '''option''' key while starting Firefox.
* On Linux you can open Firefox 4.0+ in Safe Mode by quitting Firefox and then going to your Terminal and running: firefox -safe-mode (you may need to specify the Firefox installation path e.g. /usr/lib/firefox)
* Or open the Help menu and click on the '''Restart with Add-ons Disabled...''' menu item while Firefox is running.
[[Image:FirefoxSafeMode|width=520]]
''Once you get the pop-up, just select "'Start in Safe Mode"''
[[Image:Safe Mode Fx 15 - Win]]
'''''If the issue is not present in Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one. Please follow the [[Troubleshooting extensions and themes]] article for that.
''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.''
''When you figure out what's causing your issues, please let us know. It might help other users who have the same problem.''
Thank you. -
I am getting a 42404 error message when opening itunes and itunes will not let me connect my iphone to it trying to get me to restore. I need help? I am not that technically inclined and really simple terms are appreciated.
Try downloading the songs from a different device. If you are doing it from your iOS device, try form your computer.
-
I keep getting the following error message when I try to update my itunes, "There is a problem with this windows installer package. Aprogram run as part of the set up did not finish as expected. Contact your support personnel or package vendor."
Yes, I had found a similar solution also. I'm running XP Pro, SP3. I went Control Panels/ Add-Remove programmes/apple software update/ change/ repair. Then run the 10.5 exe.
While the programme updated from version 8 of iTunes, my new iTunes is now a mess. Not all of my music was in the same folder previously but it all showed up on iTunes. Now many albums have been left out, some have only a few tracks and some have two copies of some tracks as well as having other tracks missing. I haven't begun to work on that. -
Just recently I am getting the following error message when trying to access web sites. I am using Firefox browser version 10.0.2. I get a pop up window stating "Exc in ev handl: TypeError: c.location is null" as the web site page is being displayed in browser winder. Then I have to click ok. It doesn't matter what web link/site I go to it happens. It is an issue with some plug-in?
I have advised McAfee's product team of the problem and this thread, and they're looking into it now.
-
I am getting the following error message when I try to import photos into iPhoto from my camera: "/private/var/folders/GB/GBl4wh8-ELqUVMI5dO-ryU TI/-Tmp-/iPhoto/DSCF2033.JPG". Have already tried removing and reinstalling iPhoto to no avail.
Does this happen if you try to Import to Library within iPhoto, or is it when you connect your camera (and which is set to automatically use iPhoto) that this error message occurs?
If you open Image Capture > Preferences is iPhoto selected as the choice when a camera is connected? -
Since updating OS to Mountain Lion from leopard, I get the following error message when trying to backup with time machine on external drive. "Could not complete backup to media share. The network backup disk does not support the required AFP features." What are AFP features and how do I get Time Machine to backup to my current external backup?
This means that your NAS does not support the required encryption. Update your NAS to the latest firmware or ditch it and buy a Time Capsule (they are the most reliable when using TM).
-
Error message when compiling book "file is corrupt" referring to a photo. Or "cannot find original photo". Can you use photos that have been "edited" out of "Book Mode"?
I did copy it to my desktop, but it still won't let me open it. I think the file on the disc might be corrupt or something like that though the cd itself checks out fine as far as viruses go. I was able to verify the disc, but that's about it. My husband tried it on his iMac and we have the same issue. It's unzipping the folder, but won't let us open the folder on both the Mac Book Pro or the iMac by double clicking, going to file/open or right clicking. It just keeps saying the same message as I posted above. I think I'm just going to have the client put the pictures on either a memory card or a USB memory stick so she won't have to compress the files for zipping purposes. It's been too frustrating trying to open this folder on this cd she gave me. She said she created/zipped the cd on her Mac Book Pro but it sure won't open on mine.
-
I am trying to update my iTunes to 10.5.1 so that I can upgrade my 3GS phone but am getting the following error message when trying to install the itunes: Install step failed: Run pre upgrade script for apple mobile device support. Contact software manufacturer for assistance. I am on a MacBook pro running 10.5.8 OS. Has anyone seen this before and how can I get it resolved.
Thanks for your help in advance....Did you ever figure out the problem? "Contact Software Manufacturer"?? That sounds ominous... I've got the same issue and I'm pretty durn aggravated right about now....
Thanks! -
I get the following error message when trying to download ITunes on my computer running Windows XP - Error writing to file: C:\Program Files\Common Files\Apple Application Support\CFNetwork.dll
For general advice see Troubleshooting issues with iTunes for Windows updates.
The steps in the second box are a guide to removing everything related to iTunes and then rebuilding it which is often a good starting point unless the symptoms indicate a more specific approach. Review the other boxes and the list of support documents further down the page in case one of them applies.
The further information area has direct links to the current and recent builds in case you have problems downloading, need to revert to an older version or want to try the iTunes for Windows (64-bit - for older video cards) release as a workaround for installation or performance issues, or compatibility with QuickTime or third party software.
Your library should be unaffected by these steps but there also links to backup and recovery advice should it be needed.
tt2 -
I get the follow error message when i try to update my Iphone on I Tunes " fireware is not capatible 2
got an anti virus that thinks it should scan email. Turn that function off.
Have a firewall, check that Thunderbird has full internet access, not some Auto rubbish that somehow fails. -
Trying to install iTunes on my Dell laptop with Windows 7 - 64 bit. Get these two error messages when I run the iTunes exe file: Error 2 and Error 2 (Windows error 2). Both say Apple Application Support was not found. Can anyone tell me why this is happening?
See Troubleshooting issues with iTunes for Windows updates.
tt2 -
On My Mac Pro Getting an unknown error message when trying to update apps
On My Mac Pro Getting an unknown error message when trying to update apps To Perchase Mountain Lion
Try signing out of your account, restart the iPad and then sign in again and see if that works for you.
Settings>Store>Apple ID - tap your ID and sign out.
Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.
Sign in again -Settings>Store>Apple ID - sign in.
If that doesn't work either, reset your iPad and see if that helps.
Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. -
Hi,
I’m getting the following error message when ever I try to start cs6 and the program gets close.
“Adobe Photoshop CS6 has stopped working. A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available”
Please advise what is the problem? and How to sort this out?
OS Name
Microsoft Windows 8.1 Pro
Version
6.3.9600 Build 9600
Other OS Description
Not Available
OS Manufacturer
Microsoft Corporation
System Name
JARVIS
System Manufacturer
Dell Inc.
System Model
Inspiron N5110
System Type
x64-based PC
System SKU
To be filled by O.E.M.
Processor
Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz, 2501 Mhz, 2 Core(s), 4 Logical Processor(s)
BIOS Version/Date
Dell Inc. A11, 8/3/2012
SMBIOS Version
2.6
Embedded Controller Version
1.01
BIOS Mode
Legacy
BaseBoard Manufacturer
Dell Inc.
BaseBoard Model
Not Available
BaseBoard Name
Base Board
Platform Role
Mobile
Secure Boot State
Unsupported
PCR7 Configuration
Binding Not Possible
Windows Directory
C:\Windows
System Directory
C:\Windows\system32
Boot Device
\Device\HarddiskVolume2
Locale
United States
Hardware Abstraction Layer
Version = "6.3.9600.17196"
User Name
Jarvis\JARVIS\Abhishek
Time Zone
India Standard Time
Installed Physical Memory (RAM)
4.00 GB
Total Physical Memory
3.16 GB
Available Physical Memory
1.21 GB
Total Virtual Memory
3.72 GB
Available Virtual Memory
1.55 GB
Page File Space
576 MB
Page File
C:\pagefile.sys
Hyper-V - VM Monitor Mode Extensions
Yes
Hyper-V - Second Level Address Translation Extensions
Yes
Hyper-V - Virtualization Enabled in Firmware
Yes
Hyper-V - Data Execution Protection
Yes
Display adapters:
and NVIDIA GeForce GT 525M.Without the actual crash logs nobody can say, but chances are that your graphics hardware is to blame, so update the driver...
Mylenium -
I upgraded my iphone 5 to iOS 8 and now i get an itunes error message when I try to sync "this iphone cannot be synced. Unknown error. (-50). my icloud drive was stuck in an upgrade cycle, but i've stopped that and still get the error message.
I restarted itunes and tried again (based on a similar question/solution from 2012).
I don't get the error message anymore, but it's really sort of odd that after step one of sync, it looks as if sync stopped, and then all of a sudden you see step 4 of sync.
Also before the upgrade I had 7+ gigs of space free and after the upgrade I have 10 gigs free. seems like something is amiss, but it's not like I have anyway of determining that.
Maybe you are looking for
-
Third party sales configuration
Dear I needed your guidance for third party sales when vendor supply the material to the customer we keep item category group BANS and stock entered virtually in our stock and then vendor invoice generated and received by the company through MIGO and
-
Would like to buy an notebook with 16:10 screen
Hi, I would like buy a new portable computer with 16/10 screen ( and not 16/9 ! ). Where I can find these ? Thank you.
-
Hi all, Please can you help me with that Error: When i create EUL the following error occured:- "The following error occured while installation(see eulinst.log for details)-install failed, cause:ORA-00603:oracle server terminated by fatel error". the
-
Can a Java app run in the background?
I want to put an app on a server that runs at a certain time of day (probably something like midnight, not sure yet) that just performs a task without any notifications. Is Java suitable for this task?
-
I purchased the Inspiron 7537 (i7 4500U, 8gb RAM, Nvidia GT750M). Issues: 1. Hiss noise from headphone socket (Same as my Studio 1558, DELL's RnD is a bullshit) 2. Wifi range is low, connectivity is not good (Cant blame dell, cos same issues with oth