what is the error

what is the error

What is the compile time error that i am getting while compiling the application.
Thanks!

View Answers

February 21, 2008 at 6:31 PM

SOLUTION :-
Your program is creating the compile time error
such as : - ? CANNOT FIND SYMBOL ? because you have declared variable comment that?s why compiler is not able to read this .


correct code is this if you don?t want such type of error
EG : -
import java.lang.*;
// user defined classes definition
// super class

class First
{
private int data=100;
public void initdata()
{
int data=10;
}
}
// sub class
class Second extends First
{
public void showdata()
{
System.out.println("Data : " + data);
}
}
// java application class definition
class ExInherit1
{
public static void main(String argv[])
{
Second o = new Second()
o.initdata();
o.showdata();
System.out.println("Data : "+ data);
}
}
this program will also show such type of error ? DATA HAS PRIVATE ACCESS IN FIRST ?because you have declared the variable data as private in class First so you can?t access it in class Second .

if you don?t declare the variable ? Private ? it will also create the error such as : ? CANNOT FIND SYMBOL ?
import java.lang.*;
// user defined classes definition
// super class

class First
{
int data=100;
public void initdata()
{
int data=10;
}
}



// sub class
class Second extends First
{
public void showdata()
{
System.out.println("Data : " + data);
}
}


// java application class definition
class ExInherit1
{
public static void main(String argv[])
{
Second o = new Second();
o.initdata();
o.showdata();
//System.out.println("Data : "+ data);
}
}

if you want error free program the correct code is : -
import java.lang.*;
// user defined classes definition
// super class

class First
{
ssint data=100;
public void initdata()
{
int data=10;
}
}



// sub class
class Second extends First
{
public void showdata()
{
System.out.println("Data : " + data);
}
}


// java application class definition
class ExInherit1
{
public static void main(String argv[])
{
Second o = new Second();
o.initdata();
o.showdata();
}
}

THE OUTPUT OF THIS CODE : 100









Related Tutorials/Questions & Answers:
What is a stack overflow error?
What is a stack overflow error?  What is a stack overflow error
what kind of error
what kind of error  SEVERE: Error deploying configuration descriptor WebApplication2.xml java.lang.NoClassDefFoundError: javax/faces/webapp/FacesServlet at com.sun.faces.config.FacesInitializer.<clinit>
Advertisements
what is the error - Java Beginners
what is the error  What is the compile time error that i am getting... is creating the compile time error such as : - ? CANNOT FIND SYMBOL ? because you... this .correct code is this if you don?t want such type of error EG : - import java.lang.
What is the error in this coding?
What is the error in this coding?  <% Class.forName("com.ibm.db2.jcc.DB2Driver"); System.out.println("driver loaded sucesssssssssssssssssss"); Connection Conn=DriverManager.getConnection("jdbc:db2://localhost:50000/VOTERS
what is the resolution for the bellow error?
what is the resolution for the bellow error?  pe Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException
what error in this program plese correct it
what error in this program plese correct it  import java.io.*; class y { public static void main (String args[]) { Data inputStream dis = new Data inputstream(System.in); float l,b,a; Systyem.out.println("enter the lengh"); l
403 Forbidden error - What is 403 Forbidden error, please explain...
403 Forbidden error - What is 403 Forbidden error, please explain...  Can anyone please explain, What is 403 Forbidden error. And how can i remove this error, which is restricting my page from loading it. Thanks!!   Hi
403 Forbidden error - What is 403 Forbidden error, please explain...
403 Forbidden error - What is 403 Forbidden error, please explain...  Can anyone please explain, What is 403 Forbidden error. And how can i remove this error, which is restricting my page from loading it. Thanks!!   Ok
error
error  while iam compiling iam getting expected error
Error-
Error-   Hello, I would like to know about XSD file. I try to print XML file but I am getting error SAXException-- says Content is not allowed in prolog. Please help me
error
error  i have 404 error in my program plz tell me yhe solution about
error
error  i have 404 error in my program plz tell me yhe solution about
error
/ServletUserEnquiryForm.shtml getting an error given below SQLException caught: [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error please suggest
Error
Error  I have created ajax with php for state and city. When I change state then city will not come in dropdown list and it give me error as 'Unknown Runtime Error'. This error come only in IE browser, but in other brower
error
error  java.lang.unsupportedclassversionerror:bad major version at offset 6 how to solve this????   Hi, Please check the version of framework used and also the JDK version.ADS_TO_REPLACE_1 This type error also comes
error
error
error
error  When I deploye the example I have this message cannot Deploy HelloWorld Deployment Error for module: HelloWorld: Error occurred during deployment: Exception while deploying the app [HelloWorld
error!!!!!!!!!
error!!!!!!!!!   st=con.createStatement(); int a=Integer.parseInt(txttrno.getText()); String b=txttname.getText(); String c=txtfrom.getText(); String d=txtto.getText
error!!!!!!!!!
error!!!!!!!!!   st=con.createStatement(); int a=Integer.parseInt(txttrno.getText()); String b=txttname.getText(); String c=txtfrom.getText(); String d=txtto.getText
error!!!!!!!!!
error!!!!!!!!!   st=con.createStatement(); int a=Integer.parseInt(txttrno.getText()); String b=txttname.getText(); String c=txtfrom.getText(); String d=txtto.getText
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package...;"); // ERROR out.println(" var pattern
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package...;"); // ERROR out.println(" var pattern
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package...;"); // ERROR out.println(" var pattern
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package...;"); // ERROR out.println(" var pattern = /^\d{3,5
error
"+it); } } this is my program i am getting an error saying cannot find symbol class stringADS
error
error  whats the error.............. import java.util.Scanner; public class g { public static void main(String[] args) { Scanner s=new Scanner(System.in); int d,x,y; System.out.println("Enter the first number
PHP Trigger Error
PHP Trigger Error PHP trigger_error generates an error, warning, notice message. Basic format of the trigger_error is as follows: boolean trigger_error ( string $error_message <, int $error_type = E_USER_NOTICE >)ADS
error
error
error
error
error
JSP error
JSP error  what is difference between global-exception and error-page in jsp. which condition they are use
Error here
Error here  <%@ taglib prefix="s" uri="/struts-tags" %> its giving me error as: org.apache.jasper.JasperException: File "/struts-tags...:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) what
Error in JfreeChart
Error in JfreeChart  I am getting an error when i am using jfreechart for graph generation, that is: D:\my\linechart.java:5: package org.jfree.chart does not exist import org.jfree.chart.*;ADS_TO_REPLACE_1 what is the reason
Error in servlets
Error in servlets  I cant execute my servlet or jsp programs. Im getting an error resource not found. I am using tomcat 6.0. I have set the path... cannot run it. What should i do
Jcommon error
Jcommon error  hi................. what u had said i have downloaded the jar file the latest one then also its giving me same error can u tel me why... the code for bar chart and pie chart where this error will not come. and also
installation error
installation error  Error : Invalid path, "C:\Program Files\Java\jdk1.6.0\bin\javac.exe" -g -classpath "C:\Documents and Settings\Admin\My Documents...\Admin\My Documents\news.java" what does this mean
installation error
installation error  Error : Invalid path, "C:\Program Files\Java\jdk1.6.0\bin\javac.exe" -g -classpath "C:\Documents and Settings\Admin\My Documents...\Admin\My Documents\news.java" what does this mean
Error in JfreeChart
Error in JfreeChart  I am getting an error when i am using jfreechart for graph generation, that is: D:\my\linechart.java:5: package org.jfree.chart does not exist import org.jfree.chart.*;ADS_TO_REPLACE_1 what is the reason
jsf error
jsf error  type Exception report message descriptionThe server encountered an internal error () that prevented it from fulfilling this request... in the GlassFish Server Open Source Edition 3.0.1 logs. What is the reason
error message
error message  Sir i make one form facility with insert,update,delete.i want to error msg if any type of the data is missing and display in error msg which of the data is misssing
Permgen error
Permgen error  hi how can i solve permgen error
installation error
installation error  hi, m getting an error like " semicolon found in the selected path".how to resolve this error? during installation of jdk 1.6
error log
error log  hi my requirement is validate xml and xsd in java.If there is an errors then i will log error and store into error table. so plz if any one knows send code urgent. error table details-------------- Table
MAin error
MAin error  Error while running hello program in another dir rather in bin. path is already set. java -version jdk1.6.0_24 no error while compilation but @ d tym of runnin error in main class is generated Exception in thread
JSF error
JSF error  some of the users are not able to update the db. getting the error "An Error Occurred: Error calling action method of component with id CreateorManageOffer:jidjsp134312524923 Caused by: java.lang.NullPointerException
404 error
into jboss->server-> default->deploy folder it doesn't shows any error. but when i run this application by using localhost:8080/webapp ,it shows 404 error how should i slove this error
404 error
404 error  struts application having 404 error while hosting to a online server.it works fine in my local machine but dont work in virtual host.showing 404 error
Error display
Error display  I want to give a message on the screen that an error has occured...but I dont want to use alert and give pop up box...any other solution for the problem

Ads