Home Answers Viewqa Java-Beginners Java Code Explanation

 
 


Harish Choudhary
Java Code Explanation
0 Answer(s)      2 months and 23 days ago
Posted in : Java Beginners

Can you please Explain the following code :

import java.util.*; class Difference { public static void main(String args[]) { int n,i,res=0,sum=0,dif; System.out.println("Enter the number"); Scanner in= new Scanner(System.in); n=in.nextInt(); for(i=1;i<=n;i++) res=res+i; res=res*res; for(i=1;i<=n;i++) sum=sum+i*i; if(sum>res) dif=sum-res; else dif=res-sum; System.out.println("Result:"+dif); } }

View Answers









Related Pages:
Java Code Explanation
Java Code Explanation  Can you please Explain the following code : import java.util.*; class Difference { public static void main(String args[]) { int n,i,res=0,sum=0,dif
Java Code Explanation
Java Code Explanation  Can you please Explain the following code : import java.util.*; class Difference { public static void main(String args[]) { int n,i,res=0,sum=0,dif
explanation to your code - Java Beginners
classes.sir i need your brief explanation on this code and also your guidance.this...explanation to your code  sir, I am very happy that you have responded to my doubts in no time.Thank you very much.I saw the code u sent.Can i
explanation - Java Beginners
/GarbageCollection.shtml http://www.roseindia.net/java/example/java/io/code...explanation  I have create small java appication. I don't know about... java application.   Hi Friend, Please visit the following links
huffman code give the explanation for this code
huffman code give the explanation for this code  package bitcompress...); } value = 0; bit_count = 0; } } else { int code; bit_array[bit_count++] = bit; if ((code = huffcode_find (bit_array
huffman code give the explanation for this code
huffman code give the explanation for this code  package bitcompress...); } value = 0; bit_count = 0; } } else { int code; bit_array[bit_count++] = bit; if ((code = huffcode_find (bit_array
example explanation - Java Beginners
example explanation  can i have some explanation regarding the program given as serialization xample....  Hi friend, import java.io..../java
explanation
the explanation in internet,but not very clear about it. Thank you
java code - Development process
java code  hi, this is sampath, how to acchive the batch processing in java or batch process base java thread. can u send the code and brief explanation. thanks and regards sampath reddy
code in java - Development process
code in java  program for a two user chess game(Users must be on different systems) please send me this source code to my mail id with step by step explanation.  Hi Friend, Please visit the following link: http
code
code    how to write this in java
code
code   hi I need help in creating a java code that reminds user on a particular date about their festival. i have no clue of how to do it.. am looking forward to seek help from you
code
code  < comp xlink:type="new" xlink:actuate="onload"/> how to write this in java
Code
Code  how to print this?? with the use of only JSP....... 1 23 456 78910   Here is the jsp number pattern example: 1 2 3 4 5 6 7 8 9 10 <%@page language="java"%> <% int k = 1; for(int i=1; i<= 4 ;i
Java Next()
in Java. The description of the code is given below for the usage of the method... Java Next()       In this section, you will get the detailed explanation about the next() method
Java nextElement()
of interface Enumeration in Java. The description of the code is given below... Java nextElement()       In this section, you will get the detailed explanation about the nextElement
Java hasMoreElement()
() method of interface Enumeration in Java. The description of the code is given... Java hasMoreElement()       In this section, you will get the detailed explanation about
Java remove()
in Java. The description of the code is given below for the usage of the method... Java remove()       In this section, you will get the detailed explanation about the remove() method
charAt() Method In Java
charAt() Method In Java       In this section, you will get the detailed explanation about... the following java program. This program reads a string as input through
JAVA code For
JAVA code For   JAVA code For "Traffic signals Identification for vehicles
String indexOf() Method
class in Java. The description of the code is given below for the usage...() method through the following java program. In the program code given below, we...; In this section, you will get the detailed explanation about
java code
java code  what is the code to turn off my pc through java program
JAVA CODE
JAVA CODE  JAVA SOURCE CODE TO BLOCK A PARTICULAR WEB SITES(SOCIAL WEB SITE
java code
java code  write a java code to convert hindi to english using arrays
java code
java code  develop a banking system in java
java code
java code  hi any one please tell me the java code to access any link i mean which method of which class is used to open any link in java program
java code
java code  how to extract html tags using java
java code
java code  need java code for chart or graph which compare the performance of aprior algorithm and coherent rule algorithm.plz any one help me out
java code
java code  write a java code for finding a string in partiular position in a delimited text file and replace the word with the values given by user and write the file in new location
java code
java code  sir how to merge the cells in excel using java code please help me and also how to make the text placed in the cell to be center
java code
java code  sir how to merge the cells in excel using java code please help me and also how to make the text placed in the cell to be center
java code
java code  I need the java code that would output the following: HARDWARE ITEMS CODE DESCRIPTION UNIT PRICE K16 Wood screws,brass,20mm $7.75 D24 Wood glue,clear,1 liter $5.50 M93
Java code
Java code   Create a washing machine class with methods as switchOn, acceptClothes, acceptDetergent, switchOff. acceptClothes accepts the noofClothes as argument & returns the noofClothes
Changing the value of Array in Java
array program is provided Java application program about the explanation with Java Source code.  Here we are going to make a program to follows the one... Changing the Value of Array in Java   
java code
java code  what is meaning bufferedreader
java code
java code  what is meaning bufferedreader
getParameterNames() Method Of The Request Object
the detailed explanation about the getParameterNames() method of the request object. You.... These values are later retrieved through the java programming language.... This section provides JSP file which complete code is given below, provides the facility
JSP code - JSP-Servlet
JSP code  Hi! Can somebody provide a line by line explanation of the following code. The code is used to upload and download an image. <... have successfully upload the file by the name of: Download /*Code
java code
java code  I am beginer in java my question is how can i fill data from mysql database to jcombobox using netbeans
Java Code
Java Code  Write a java program, which creates multiple threads. Each thread performs add/delete/update operations on an ArrayList simultaneously
java code
java code  An employee _id consist of 5 digits is stored in a string variable strEmpid. Now Mr.Deb wants to store this Id in Integer type to IntEmpid. write Java statements to do
java code
java code  HOW TO PRINT 1 TO 100 WITHOUT USING CONDITIONAL,ANY LOOP AND ARRAY IN JAVA AND C.URGENT SIR PLZ  Hi, You can use following code: class MyClass { public static void main(String[] args) { int
java code
java code  Write a program to find the difference between sum of the squares and the square of the sums of n numbers
java code
java code   Develop a program that accepts the area of a square and will calculate its perimeter
java code
java code  Create a calculator class which will have methods add, multiply, divide & subtract
java code
java code  input any word ie risk,resul is-- r ri ris risk
java code
java code  Develop the program calculateCylinderVolume., which accepts radius of a cylinder's base disk and its height and computes the volume of the cylinder
java code
java code  Develop the program calculateCylinderArea, which accepts radius of the cylinder's base disk and its height and computes surface area of the cylinder
java code
java code  Create a washing machine class with methods as switchOn, acceptClothes, acceptDetergent, switchOff. acceptClothes accepts the noofClothes as argument & returns the noofClothes
Java code
Java code  Write a program which performs to raise a number to a power and returns the value. Provide a behavior to the program so as to accept any... the following code: import java.util.*; import java.text.*; class NumberProgram

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.