| | |
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: 296 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for Java
actionlistener android api apple applet application arguments array arrays automation binary bluetooth character chat class classes client code component consumer database desktop detection draw eclipse encode error event exception file fractal ftp game givemetehcodez graphics gui helpwithhomework html ide image input integer j2me java javac javaee javaprojects jmf jni jpanel julia linked linux list loop mac map method methods mobile netbeans newbie number object online oracle os print printf problem program programming project properties recursion researchinmotion rotatetext rsa scanner score screen server set size sms socket sort sql string swing template test threads time transfer tree update windows working xstream





