Archive for category: Programming

Hide And Access Data In Employee Class

This is a Java program to define employee class and to show how data can be hidden and accessed. Coding: class emp { public static int emp_no; public static String name; public static String designation; public void showdata() { System.out.println(“Employee number:—>”+emp_no); System.out.println(“Employee name:——>”+name); System.out.println(“Employee designation:—>”+designation); } } class salary...

Continue reading

Merge Two Files Into A Third File

This is a Java program to merge two files into a third file. Coding: import java.io.BufferedReader; import java.io.FileReader; import java.io.FileWriter; public class Main {  public static void main(String args)  { FileReader file1=newFileReader(“Data1.txt”); Scanner scan = new Scanner(newFile(“Data1.txt”)); ArrayList<Integer> values = newArrayList<Integer>(); collections.sort(values);  while(scan.hasNextInt()) values.add(scan.nextInt());  FileReader file2=newFileReader(“Data2.txt”); Scanner scan =...

Continue reading

Insert and delete records for student class

This is a Java program to insert and delete records for a Student class. Coding: import java.util.*;  class Student{ int id; String name; int age; String department; String course; String grade; double gpa;  Student(int id, String name,int age,String department,String course,String grade,double gpa) { this.id=id; this.name=name; this.age=age; this.department=department; this.course=course; this.grade=grade;...

Continue reading

Sorting of Numbers

This is a Java program to sort the given set of numbers Coding: class sort { public static void main(String args) { int number={55,40,80,65,71}; int n=number.length; System.out.println(“given list”); for(int i=0;i<n;i++) { System.out.println(“”+number); } for(int i=0;i<n;i++) { for(int j=i+1;j<n;j++) { if(number<number) { int temp=number; number=number; number=temp; } } } System.out.println(“sorted...

Continue reading

CONTACT US

We're not around right now. But you can send us an email and we'll get back to you, asap.

Sending

©2015 Univseeker

Log in with your credentials

Forgot your details?