Professional Documents
Culture Documents
Expt09 159
Expt09 159
// Name
Roll No.-159
//Div:B
Program :
import java.io.*;
import java.util.Scanner;
class StudInfo{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
try{
//FileOutputStream f1=new FileOutputStream("Student.txt");
//DataOutputStream d1 = new DataOutputStream(f1);
DataOutputStream d1 = new DataOutputStream(new
FileOutputStream("Student.txt"));
String name,age,weight,height,city,phone;
System.out.println("Enter your name: ");
name=sc.next();
System.out.println("Enter Your age:");
age=sc.next();
d1.writeBytes(System.lineSeparator()+name);
d1.writeBytes(System.lineSeparator()+age);
d1.writeBytes(System.lineSeparator()+weight);
d1.writeBytes(System.lineSeparator()+height);
d1.writeBytes(System.lineSeparator()+city);
d1.writeBytes(System.lineSeparator()+phone);
d1.close();
Output: