Java Hyd Team
746 subscribers
986 photos
39 videos
670 files
690 links
https://teamhydteam.my.canva.site/

Can visit us on our website 😊
Still working on it 😊
Download Telegram
Anyone wanna learn java8 functions can connect using this link
connect fast
5_6273590847309088325.pptx
611.3 KB
JAVA 8 Functionalities
https://docs.google.com/spreadsheets/d/1j5O9_P7DbsqNLjv5s-DmYGvRey_GRwPLAOVpWXJ7s8Y/edit?usp=sharing click on this link to join the new sheet i will update by today night
Anyone wanna join this ?
1
public class Student { private int studentId; private String studentName; private int marks; private char grade; public Student() { // TODO Auto-generated constructor stub } public Student(int studentId, String studentName, int marks) { super(); this.studentId = studentId; this.studentName = studentName; this.marks = marks; calculateGrade(); } public String displayDetails() { return "Student [name=" + studentName + ", studentId=" + studentId + ", marks=" + marks + ", grade=" + grade + "]"; } private void calculateGrade() { if (marks <= 100 && marks >= 90) { grade = 'A'; } else if (marks <= 89 && marks >= 81) { grade = 'B'; } else if (marks <= 80 && marks >= 71) { grade = 'C'; } else if (marks <= 70 && marks >= 61) { grade = 'D'; } else if (marks <= 60 && marks >= 0) { grade = 'E'; } } }

public class Tester { public static void main(String[] args) { Student s1 = new Student(123, "John Smith", 95); System.out.println(s1.displayDetails()); } }

Output:

Student [name=John Smith, studentId=123, marks=95, grade=A]
There are five different ways to create an object in Java:
Java new Operator
Java Class.newInstance() method
Java newInstance() method of constructor
Java Object.clone() method
Java Object Serialization and Deserialization
class_name object_name = new class_name()
public T newInstance() throws IllegalAcccessException
public T newInstance(Objects...initargs)