jQuery in Action, 2nd edition*
The moose likes Beginning Java and the fly likes Core Java: Class and Object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Core Java: Class and Object" Watch "Core Java: Class and Object" New topic
Author

Core Java: Class and Object

sailaja cherukuri
Greenhorn

Joined: May 02, 2013
Posts: 9
package objectconcept;

class Object1
{
static int papercount=0;
static void print()
{
if(papercount>0)
{
papercount=papercount-1;
System.out.println("Documented printed");
}
else
{
System.out.println("please load the paper in the tray");
}
}
void printDocument()
{
print();
}
}
....................

package objectconcept;

class PrintObject
{
public static void main(String args[])
{
PrintObject p1= new PrintObject();
PrintObject p2=new PrintObject();
p1.PrintDocument();
p2.PrintDocument();
}
}
......................

hii In first program i wrote static and non static.. ( class level and object level) ... with out main method.. so it is compiledd......
In 2nd program i create an object for non static(object level) ... but for 2nd program i am getting an errorss as

PrintObject.java:9: error cannot find symbol
p1.PrintDocument();

symbol: method PrintDocument()
location: variable p2 of type PrintObject
2 errors


Stuart A. Burkett
Ranch Hand

Joined: May 30, 2012
Posts: 679
Your PrintObject class doesn't have a PrintDocument method.
sailaja cherukuri
Greenhorn

Joined: May 02, 2013
Posts: 9
i am using class object1 there is void printDocument() method .. this method i am using in class PrintObject program....... check it once..
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

sailaja cherukuri wrote:check it once..

Why don't you check it? PrintDocument is not the same as printDocument.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
sailaja cherukuri
Greenhorn

Joined: May 02, 2013
Posts: 9
haha....... yaya i got it noww....... i check it ...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Core Java: Class and Object