Upcoming SlideShare
×

# Exercises of java tutoring -version1

869

Published on

Published in: Education
2 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total Views
869
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
0
0
Likes
2
Embeds 0
No embeds

No notes for slide

### Exercises of java tutoring -version1

1. 1. Java TutoringExercisesJava tutoring programs and outputsThis document covers basic Java examples which shows how to build program using Pass ByValue and inheritance and how to read input from the keyboard. Author : Uday Sharma
2. 2. Java Tutoring ExercisesExercise 1:Basic Calculator/** * * @author Udaysharma * This is simple basic java program which perform Addition, Substraction,Multiplication and Division. */public class BasicCalculator {//Global static variable//Static type variable : Are globally public variablestatic int a =10;static int b= 10;/* * Java Main method syntax * Public : is a keyword which suggest main method is accessible by publicly * Static : In java code static member executable first. * Void : There is no return value. * main : is a method which is execute beginning of the code. * String : Data type * args[] : which allows you to access Environment variable. */public static void main(String args[]){ //To store result. int c; /*********************Addition*******************/ c=a+b; //To print result in console System.out.println("Addition is C="+c); /************************************************/ /*********************Subtraction*******************/ c=a-b; //To print result in console System.out.println("Subtraction is C="+c); /***************************************************/ /*********************Multiplication*******************/ c=a*b; //To print result in console System.out.println("Multiplication is C="+c); /******************************************************/ /*********************Division*******************/ c=a/b; //To print result in console System.out.println("Division is C="+c); /******************************************************/ Author: Uday Sharma | 1