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




Have Programming Question? Ask it here!
 
 
 


kaptan singh
q
1 Answer(s)      3 years and 7 months ago
Posted in : Java Interview Questions


how to add 2 numbers in java


Advertisement
View Answers

January 28, 2011 at 10:40 AM


Hi,

Try this:

class Test{
    public int add(int a,int b){
        return a+b;
    }
    public static void main(String []args){
        Calculation cal=new Calculation();
        int add=cal.add(5,10);
        System.out.println(add);
        }
}

Thanks



Related Tutorials/Questions & Answers:
q
sql q's
sql q's  Find out the job that was filled in the first half of 1983 and same job that was filled during the same period on 1984? Display... before 15th of the month? For the above Q's please respond quickly all the queries
Advertisements
q in java
q in java  Designed a program that allows the user to enter a name Then the program prints the characters of a-z and after each letter means... f 0 g 0 h 1 i 0 j 1 k 0 l 0 m 0 n 1 o 1 p 0 q 0 r 0 . . . . z 0   up
HTML - Q (quotation) tag.
HTML - Q (quotation) tag. Description : It generates a quotation over the text. Code : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional
Please help with this Q ASAP
Please help with this Q ASAP  The University wants to make a basic graphical display to show how many people received different grades for a piece of work on a module. You are required to write a program in Java that achieves
Q, 12 WAP to calculate addition of two distances in feets and inches using objects as functions arguments in java
Q, 12 WAP to calculate addition of two distances in feets and inches using objects as functions arguments in java  Q, 12 WAP to calculate addition of two distances in feets and inches using objects as functions arguments in java
Q - Java Terms
Q - Java Terms       Java Quartz Framework Quartz is an open source job scheduler.  It provides powerful mechanisms for job scheduling. It can
Java: Method FAQs
Java: Method FAQs Q: Do we always have to write a class name in front... could write the following, but I've never actually seen a program use it. Q... may be defined in any order, unlike some languages (eg, C++). Q: Doesn't
Jakarta Struts Interview Questions
;    Q: What is Jakarta Struts Framework... applications with Java. Q: What is ActionServlet? A: The class... for handling all the requests.    Q: How you will make available any
java - Java Beginners
example.  class q { int a,b; q() { a=0;b=0; } q(int x) { a=x; b=x; } q(int x,int y) { a=x; b=y; } public... { public static void main (String[] args) { q q1=new q(); q1.print(); q
spring 15/03/14
spring 15/03/14  Q) What are the various action performed when an application context is created? Q) Why spring is lightweight? Q) What is nested bean? Why it is useful
view.jsp
view.jsp  Q:view data from database
JAVA Write code which converts propositional expressions into clauses using the INOA rules
<=> q is written as imp p q. Typical dialog should be this, where I have...: and p q Clauses are: p q Enter wff: imp p and q r Clauses are: or not p q or not p r Turn in: â?¢ Printout of your code. â?¢ Test
array
array  WAP in java to store 6 element in array P and 4 element in array Q. Produce the third arra y R containing all element from p & q
core java 15/03/14
core java 15/03/14  Q )how to make arraylist as reads only
hibernate 15/03/2014
hibernate 15/03/2014  Q )in second level cache which type of date we will store in database
mp3 player in c# GUI - Framework
mp3 player in c# GUI  Q. I WANT TO CREATE A MP3 PLAYER IN C# WITH SOUND CONTROL AND PROGRESS BAR
CORE JAVA
CORE JAVA  Q)How to sort a Hash Table, if you pass an Employee Class Object in that First Name, Last Name, Middle Name based on last name how you sorting the Employee Class? Q)How to display the list variables in reverse
Write a java application program........?
Write a java application program........?  Welcome every One : I have Q in Java? Q : Write a java application program that reads 20 integer numbers input by the user and prints how many numbers > 100 and how many numbers
java - Log4J
java  Q What is the real use for log4J?  Hi Friend, Please visit the following link: http://www.roseindia.net/tutorials/log4j/index.shtml Thanks
Servlet - Java Interview Questions
Servlet  Q why javasoft has declared HttpServlet Class as an Abstract Class althoug there is no abstract method availiable in HttpServlet Class
DynaActionForm
DynaActionForm   Q. What is DynaActionForm ? and How you can retrive the value which is set in the JSP Page in case of DynaActionForm
java question 15/03/2014
java question 15/03/2014  Hi Q)my array size is 10, then how can i identify class A object from array. Q) how jvm know a particular object is serialize or not . Q) i have a table in that table some data duplicate than how
JAVA
JAVA  Q)Tell me some Java Exception types that you got so far and explain the Scenarios? Q)Suppose if you type wrong tag syntax in your JSP. When you run the JSP what exception will throw? Q)Suppose in your java coding part you
JAVA
JAVA  Q)Tell me some Java Exception types that you got so far and explain the Scenarios? Q)Suppose if you type wrong tag syntax in your JSP. When you run the JSP what exception will throw? Q)Suppose in your java coding part you
JAVA
JAVA  Q)Tell me some Java Exception types that you got so far and explain the Scenarios? Q)Suppose if you type wrong tag syntax in your JSP. When you run the JSP what exception will throw? Q)Suppose in your java coding part you
help in java
help in java   Rational Numbers Rational numbers are numbers that can be represented as a fraction p / q where p is an integer number and q is a positive integer (q != 0). Design and implement a Java class RationalNumber
PHP - WebSevices
modification var $q; function dbElement(){ /* Make connection to database...()); } function getElementTable(){ $q = "SHOW TABLES"; $result = mysql_query($q, $this->connection); if(!$result || (mysql_num_rows($result) < 1
SCJP Module-2 Question-18
String q = "Hello "; public static void main(String[] args) { new... { subclass2(); } catch (Exception e) { q += "Friends"; } } void subclass2() throws Exception { subclass3(); q += "and"; subclass3
jsp - JSP-Servlet
jsp  Q) I need code to generate pie chart in JSP? Thanks for answering prevoius questions. Thank u  Hi friend, Code to solve the problem : Thanks
jsp - Java Server Faces Questions
jsp  Thanks for answering previous questions . Q)I need a code to draw line graph in jsp Thank u Happy new year  Hi friend, Code to help in solving the problem : Thanks
Merge two list into a single list
*mergelist (struct node *p, struct node *q) { struct node *r=NULL,*temp; if (p == NULL) r = q; else if(q == NULL) r = p; else { if (p->data < q->data ) { r = p; temp = p; p = p->link; temp->
JDBC
JDBC  Q)How you define out param in Stored Procedure and what is the data type defined for OUT Param in Stored Procedure? Q)You have one Stored Procedure. In that Procedure When you run the Procedure you got one exception. You
.csv file to databse
.csv file to databse  I have an 1 .csv file.. its having the url values like http://maps.google.com/?q=425+Bingeman+Centre+Drive%2c+chrompet%2c+ON%2c+600+006... q is request parameter .425 Bingeman Centre Drive is address
Wamp server error
Wamp server error  Whenever i am executin program of database connectivity using php i am getting error to the following statement: $q="select password from login where username=".$uid; while($row=mysqlfetcharray($q)) I am
java beginners - Java Beginners
java beginners   Q. 1 How is class related to data abstraction? Q. 2 what is the relationship between a class and an object? thanks  Hi Friend, 1)Data Abstraction is used to hide certain details that we
Inerview Questions - Design concepts & design patterns
Inerview Questions  HI Once i faced this intreview Q What are the main difficulties that you are faced in your project ? Though I gave some... they were looking for by this Q. Was it some technical challenges Were
imp
(x<=(n*n)) { for(i=p;i<=q;i...;=q;i++) { a[i][q]=x; x++; } for(i=(q-1);i>=p;i--) { a[q][i]=x
imp
)) { for(i=p;i<=q;i++) { a[p][i]=x; x++; } for(i=(p+1);i<=q;i++) { a[i][q]=x; x
finding the eigenvalues and eigenvector of n*n matrix in java
[][] {{4,3,1,2},{1,1,1,1},{1,2,1,1},{1,1,1,1} }; double t, c, s; int p, q, icount..., rowOfElMax, maxElRow); q = rowOfElMax[0]; p = colRowOfElMax[q]; icount = 0; state = 1; // Iterations while
servlets
servlets  q)What will happen if you don??t write the implementation in service () of our Servlet? Which method () it will call? q2)How many times init() execute and what happen if browser is close and server shutdown ? JSP
please any one can help me to write a code for this question?
please any one can help me to write a code for this question?  Q 1) In a class first day 25 students are joined. After two days that total students will increased to 60. We can develop a program by using ArrayList concept
Question in Java ??
Question in Java ??   Welcome every One ,I have Q in Java : Write aprogram that print the falewing table using SQRT method in the Math Class? Number squrfoot
Question in Java ??
Question in Java ??  Welcome every One ,I have Q in Java : Write aprogram that print the falewing table using SQRT method in the Math Class? Number 0 ,2, . . . ,18,20 squrfoot 00000 1.4142 5.2426 5.4721
Question in Java ??
Question in Java ??  Welcome every One ,I have Q in Java : Write aprogram that print the falewing table using SQRT method in the Math Class? Number 0 ,2, . . . ,18,20 squrfoot 00000 1.4142 5.2426 5.4721
Export chart to JPEG file
Export chart to JPEG file  Hi. I have one problem. I have generated piecharts and barcharts using chartlib.js and jquery in jsp. Now i want to export this charts to jpeg file . how can i do this? Thank q in advance
java programs - Java Beginners
rationalNumber(int p, int q) { if (q==0){ return p; } else{ return rationalNumber(q, p % q); } } public String toString
 

 

 

DMCA.com