AJ LAB

Program to create a class and a single object and access class functions

#include <iostream> #include <stdio.h> using namespace std; class student { private: int rollno; char name[20]; int marks; float fee; public: void getdata() { cout<<“\nEnter Roll no : “; cin>>rollno; fflush(stdin); cout<<“Enter name : “; gets(name); cout<<“Enter Marks : “; cin>>marks; cout<<“Enter fee : “; cin>>fee; } void putdata() { cout<<“\nRollno is : “<<rollno; cout<<“\nName is …

Program to create a class and a single object and access class functions Read More »

Program to explain use of BufferedReader class in Java

Program in Java to input roll no and name of a student using BufferedReader class and print the details Program Code: package javaapplication1; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; public class JavaApplication1 { public static void main(String[] args) throws IOException{ InputStreamReader r=new InputStreamReader(System.in); BufferedReader br=new BufferedReader(r); System.out.println(“Enter your Roll No”); int rn= Integer.parseInt(br.readLine()); System.out.println(“Enter your …

Program to explain use of BufferedReader class in Java Read More »

Program to explain use of Scanner class in Java

Program in Java to input roll no and name of a student using Scanner class and print the details) Program Code: package javaapplication1; import java.util.Scanner; public class JavaApplication1 { public static void main(String[] args){ Scanner in= new Scanner(System.in); System.out.println(“Enter your Roll No”); int rn= in.nextInt(); System.out.println(“Enter your name”); in.nextLine(); /* To clear the input buffer …

Program to explain use of Scanner class in Java Read More »

error: You can only copy the programs code and output from this website. You are not allowed to copy anything else.