| | |
Error: Missing Return Statement
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Nov 2009
Posts: 3
Reputation:
Solved Threads: 0
After completing my code I got an error message at the second to last closing bracket that said I was missing a return statement, I looked in to it online and found that some said to put return 0; but that didn't work it just gave me a new error that said Incompatible types found: int required: Picture . Any suggestions?
Java Syntax (Toggle Plain Text)
public Picture makeGrid(int size) { Picture targetPicture = new Picture(this.getWidth()*size, this.getHeight()*size); Pixel sourcePixel = null; Pixel targetPixel = null; int targetX = 0; int targetY = 0; //loop through the source picture columns for(int sourceX = 0; sourceX < this.getWidth(); sourceX++) { //loop through the source picture rows for(int sourceY = 0; sourceY < this.getHeight(); sourceY++) { // get the source pixel sourcePixel = this.getPixel(sourceX,sourceY); // loop copying to the target y for(int indexY = 0; indexY <size; indexY++) { // loop copying to the target x for(int indexX = 0; indexX < size; indexX++) { targetX = sourceX + size*2 + indexX; targetY = sourceY + size*2 + indexY; targetPixel =targetPicture.getPixel(targetX, targetY); targetPixel.setColor(sourcePixel.getColor()); } } } } } }
![]() |
Similar Threads
- missing return statement (Java)
- Return statement? can't find the error!!! (Java)
- Missing Return Statement Error (Java)
- Missing } return statement (Java)
- Compiler says: "missing return statement"...even though I have a return statement! (Java)
- missing return statement (Java)
- missing return statement (Java)
Other Threads in the Java Forum
- Previous Thread: netbeans troubles
- Next Thread: Poker Data Retreival
Views: 295 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for Java
-xlint android animated api apple applet application arguments array arrays automation binary blackberry block bluetooth chat class classes client code component database detection developmenthelp draw eclipse encode error event exception file fractal game givemetehcodez graphics gui helpwithhomework html ide image input integer iphone j2me j2seprojects java javac javaprojects jmf jni jpanel julia lego linux list loop loops mac map method methods mobile netbeans newbie number object online oracle os page print problem program programming project recursion scanner screen server set singleton size sms socket sort sql string swing template test textfields threads time title transfer tree tutorial-sample update windows working





