Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners java Method Error
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


sushant
java Method Error
1 Answer(s)      5 years ago
Posted in : Java Beginners



Advertisement
View Answers

September 21, 2009 at 11:48 AM


Hi Friend,

You have used semi colon (;) with the declaration of mul(int x,int y) therefore you have got those errors.

Your code:

class mathoperation
{
static int add(int p,int q)
{
return(p+q);
}
static int mul(int x,int y)
{
return(x*y);
}
static int div(int c,int d)
{
return(c/d);
}
static int sub(int m, int n)
{
return(m-n);
}
}
class mathdemo
{
public static void main(String args[])
{
int r=mathoperation.add(10,20);
System.out.println("addition="+r);
int s=mathoperation.mul(10,20);
System.out.println("Multiplication="+s);
int t=mathoperation.div(10,20);
System.out.println("division="+t);
int o=mathoperation.sub(10,20);
System.out.println("subtraction="+o);
}
}

Thanks


Related Tutorials/Questions & Answers:
java Method Error - Java Beginners
java Method Error  class mathoperation { static int add(int p,int q) { return(p+q... Errors ,Please Give Me solution of Following Error G:\>javac mathdemo.java
java profram:error 405 method not found
java profram:error 405 method not found  import javax.servlet.http.*; import javax.servlet.*; import java.io.*; public class Configservlet..., Use doGet() method instead of doService() method. For more information, visit
Advertisements
java method
java method  can we declare a method in java like this static { System.loadLibrary("nativelib"); } i have seen this in a java learning E book. i don't understand the static { } plz help me. what kind of method
Java error
Java error  class WhileLoopMethod{ public static void main(String args[]){ new Hello(); } } class Hello{ int a = 5, b = 88; while(a } //it is giving compile time error .....illegal start
Java error
Java error  class WhileLoopMethod{ public static void main(String args[]){ new Hello(); } } class Hello{ int a = 5, b = 88; while(a } //it is giving compile time error .....illegal start
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java... that the program recquires a main() method in order to be runned - here is the following code...() { initComponents(); } /** * This method is called from within
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java... that the program recquires a main() method in order to be runned - here is the following code...() { initComponents(); } /** * This method is called from within
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java... that the program recquires a main() method in order to be runned - here is the following code...() { initComponents(); } /** * This method is called from within
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java... that the program recquires a main() method in order to be runned - here is the following code...() { initComponents(); } /** * This method is called from within
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java... that the program recquires a main() method in order to be runned - here is the following code...() { initComponents(); } /** * This method is called from within
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java... that the program recquires a main() method in order to be runned - here is the following code...() { initComponents(); } /** * This method is called from within
Java compilation error - Java Beginners
Java compilation error  Method overridden problems in compile time error
Class and method question, Java?
Class and method question, Java?  Consider a Java class that you..., the method should display an error message and ask the user for a new value... Prompt string** and the following method: getValue displays the prompt and reads
Java error missing return statement
Java error missing return object. For this we have taken a non void method... Java error missing return statement       Java error missing return
java error - Java Beginners
java error  G:\threading>javac threadmethods.java Note...; Hi Friend, You are using any deprecated method or something that has been obsoleted. To get the details of your error, compile your class with Xlint
java error - Java Beginners
java error  Hello sir, on compiling any program from command prompt.... But if I want to run that program the fetches me the following error. For example for file: Test.java C:\Program Files\Java\jdk1.6.0_17\bin>javac Test.java
Java Error - Java Beginners
Java Error  Here Error near Read Method import java.util.*; import java.io.*; public class inputdemo { public static void main(String[] args) throws IOException { String bookname,author; float price; System.out.println
pass method reference in java
pass method reference in java  How to pass method reference in Java
java method - Java Beginners
java method  Plz help me on toString() in java  Hi Friend, The Object class provides the method toString() that returns the string..., the toString() method of the object is automatically called. Thanks
Java Error - Java Beginners
Java Error  Hello Sir ,How i Can solve Following Error Can not find Symbol - in.readLine(); Here Error Display at in  Hi Friend, It seems that you haven't defined the object 'in'.Anyways, Send your code so that we
class method in java
class method in java  How to write a class method in Java?   You must read Java - Class, Object and Methods in Java
java method - Java Beginners
java method  i wanna explation about a method for example... Mail[] getAllMails(String userName) I WANNA EXPLATION ABOUT ABOVE METHOD CAN U... and Tutorials on Java Mail visit to : http://www.roseindia.net/javamail/ Thanks
Java Error
Java Error      ... that occurs in a program. Error in java is a subclass of the Throwable class.... Most of the errors in java are abnormal conditions while the error ThreadDeath
Using throw in java method
Using throw in java method  using throw with method implies what
try catch method in java
try catch method in java  try catch method in java - when and how should i use the try and catch method in Java ?   Please visit the following links: http://www.roseindia.net/help/java/t/java-try.shtml http
Java making a method deprecated
Java making a method deprecated  java making a method deprecated In Java how to declare a method depricated? Is it correct to use depricated... or method in Java. Instead of it you can use alternatives that exists. Syntax
runtime error in java
runtime error in java  What is Run time error in Java?   Run time error is a syntax error that during the execution of a program.It hash different types of a program like as Logic error,Fatal Errors,source code,wrong
Static Method in Java
Static Method in Java  Is Overriding Static methods possible in java? If Yes, How
getch() method in java
getch() method in java  does someone know how can i obtain the getch() function in java
Generic Method - Java Beginners
Generic Method  I want simple java program for Generic Method with explanation
JAVA Error - Java Beginners
JAVA Error  i have made my own calculator GUI..and i want the text..."); btnBack.setForeground(red); it send me an error message that goes like this unknown... the correct method i shall use to change the color of the text of my button
Advertisements
 

 

 

DMCA.com