14. Write a program in java to input three integers from keyword and find a largest integer using external class method?

import java.io.DataInputStream; class Largest {                 int x,y,z;                 void getData(int a,int b,int c)                 {                                 x=a;                                 y=b;                                 z=c;                 }                 int large()                 {                                 if(x>y && x>z)                                                 return x;                                 else if(y>z)                                                 return y;                                 else                                                 return z;                 } } class Reading {                 public... Continue Reading →

Advertisements

Creating object: –

Creating object: - An object in java is essential a block of memory that contains spaces to store all the instance variables. Creating an object is also referred to as initializing an obtained. Object in java are created using the new operator. The new operator creates an object of the specified class and return a... Continue Reading →

13. Write a program in java to calculate sum of two integer number using class object?

class Sum {                 int a,b;                 void getData(int x,int y)                 {                                 a=x;                                 b=y;                 }                 int outData()                 {                                 int s=a+b;                                 return (s);                 } } class Calculate {                 public static void main(String args[])                 {                                 int c;                                 Sum ss=new Sum();                                 ss.getData(15,25);                                ... Continue Reading →

Read method: –

Read method: - The read method used in java programming using keyword readLine. This method invoked using an object of the class DataInputStream. This method input data from keyboard as a string which is then converted to the corresponding data type. Using the data type wrapper classes. If data input from keyboard, try and catch... Continue Reading →

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: