Some facts about java

() – This is called a pair of Parentheses ;  The semicolon or semi-colon (;)  ”  double  quotation markhttps://en.wikipedia.org/wiki/Quotation_mark class first character will be capital. To create an object in java class_name      object_name(as you want)   = new(keyword)    class_name (); To call variables or fields in java object_name.variable_name = value; To refer the variables of another class  … Read more

java program for finding Area of rectangle and square using constructor overloading

 /*Area and perimeter of rectangle and square using constructor overloading. Constructor overloading means there will be two or more constructor and the name of all constructors will be same only number of arguments will be different. when you pass arguments value in the constructor it matches the number of arguments value with the defined constructor … Read more

java program to calculate area and volume using constructor

/*constructor is a special type of method in which the name of the method is same as the class and there is no return type constructor are used to initialize the value of data.*/ //Area and volume of cylinder using constructor.import java.io.*;import java.util.*;class Vol{double radius;double height;Vol(double r,double h){radius = r;height = h;}double vol(){return 3.14*radius*radius*height;}}class Area{   … Read more

java program for printing the sum of the elements inn the array

package array_sum;import java.io.*;import java.util.Scanner;     public static void main(String[] args) {          int num,i,sum=0;        System.out.println(“Enter the size of array”);        Scanner sc=new Scanner (System.in);        num=sc.nextInt();        int array[]=new int [100];        System.out.println(“Enter the elements in the array one by … Read more

Pin It on Pinterest

Open chat