Category: Java

  • Java Class Fraction Operations / Numerator and Denominator / Initialize Objects using Constructors

    Write a program to define a class Fraction having data members numerator and denominator. Initialize three objects using different constructors and display its fractional value. import java.lang.*; import java.io.*; class Fraction { double numerator,denominator,fraction; Fraction (int a, double b) { numerator=a; denominator=b; fraction=numerator/denominator; System.out.println (“Fraction1 = “+fraction); } Fraction (int x, int y) { numerator=x;…

  • Student Class / Data Members / Initialize / Display Data Values and Calculate Students Marks

    Write a program to define a class student with four data members such as name, roll no., sub1, and sub2. Define appropriate methods to initialize and display the values of data members. Also, calculate total Marks and percentage scored by the student. import java.lang.*; import java.io.*; class student { String name; int roll_no; int sub1,sub2;…

  • JAVA class with a 3 digit number data member and it’s initialize to display reverse

    Write a program to define a class having one 3-digit number, a ‘num’ as a data member. Initialize and display reverse of that number. import java.lang.*; class q1Reverse { int num,r=0,s=0; q1Reverse(int n) { num = n; } void Reverse() { while(num>0) { r=num%10; s=(s*10)+r; num=num/10; } System.out.println(“Reverse of number =”+s); } public static void main(String…

  • JAVA Inheritance With Concept and Examples / Output

    PROGRAM STATEMENT Design a super class called Staff with details as StaffId, Name, Phone, Salary. Extend this class by writing three subclasses namely Teaching (domain, publications), Technical (skills), and Contract (period). Write a Java program to read and display at least 3 staff objects of all three categories. CONCEPT [alert-announce]Here in this given problem we…

  • Stack using arrays / Push(), Pop(), and Display() methods in JAVA Programming Language

    Stack using arrays / Push(), Pop(), and Display() methods in JAVA Programming Language

    PROGRAM STATEMENT Write a Java program to implement the Stack using arrays. Write Push(), Pop(), and Display() methods to demonstrate their working. CONCEPT [alert-announce]In Java everything is encapsulated under classes. The class is the core of Java language. The class can be defined as a template/ blueprint that describes the behaviours/states of a particular entity.…

  • Creating a Java Class with Variable (Program Statement+Concepts+Sample Programs+Output)

    PROGRAM STATEMENT Create a Java class called Student with the following details as variables within it. (i) USN (ii) Name (iii) Branch (iv) Phone Write a Java program to create nStudent objects and print the USN, Name, Branch, and Phone of these objects with suitable headings. CONCEPT In Java, everything is encapsulated under classes. Class…

  • Everest Region Experiences Visitors Increased by 33%

    Everest Region Experiences Visitors Increased by 33%

    The number of Toursist visiting the Everest region is increaseing day by day. Everest region has experienced the rise of international visiotrs by 33 percentage. Even in the year 2015, during the Earthquake 36,694 tourist were recored visiting the Everest region.  “27,465 tourist came to visit Everest region in 2015 and in 2016, it was…