Hello @Unnikrishna,
It is worthwhile to look at the references related to each element of your code:
- setup() / Reference / Processing.org < You are missing this!
- draw() / Reference / Processing.org
- background() / Reference / Processing.org < discusses where to put background()
The related items are worthy of perusing as well!
When posting code keep it simple and on point.
Other references:
- Guidelines—Asking Questions < This has a link to Minimum, Complete, Verifiable Example
You can also link an image which can be useful for posted code:
size(500, 500);
PImage img = loadImage("http://learningprocessing.com/code/assets/sunflower.jpg");
img.resize(width, height);
//image(img, 0, 0);
//or
background(img);
:)