Learning Java

Explore the world of programming using Java!

Introduction to Java

1.1 -- Install Java and Eclipse IDE
1.2 -- Setup Java Project
1.3 -- Compiling the Program
1.4 -- Running and Debugging the Program

Control Flow Statements

1.1 -- if-then and if-then else statements
1.2 -- For Statements
1.3 -- Switch and While Statements
1.4 -- Branching Statements

Object Oriented Concepts

1.1 -- Classes and Objects
1.2 -- Encapsulation
1.3 -- Inheritance
1.4 -- Polymorphism

Data Structure Concepts

1.1 -- Stack
1.2 -- Queue
1.3 -- Sets and Maps
1.4 -- LinkedLists

Java Online IDE

public class Codersstack{ public static void main(String str[]){ System.out.println("Happy Coding"); } }

Thursday, December 29, 2022

Student Class Example

/**
 *  A class is a blueprint from which individual objects are created.
 *  Sample Student Class java program
 * How to create objects?
 *  Student student = new Student("My name","Grade1");
 **/

public class Student {

	String grade ;
	String studentName ;

	public Student(String studentName, String grade){            
		this.studentName = studentName ;
		this.grade = grade ;
	}
	public String getGrade()
	{
		return grade;
	}
	public void setGrade(String gradeName)
	{
		this.grade = gradeName;
	}
	public String getStudentName()
	{
		return studentName;
	}
	public void setStudentName(String studentName)
	{
		this.studentName = studentName;
	}
	
	public static void main(String str[]) {
		
		Student student = new Student("Student1", "7th") ;
		
		System.out.println("Student Name " + student.getStudentName());
		System.out.print("Student Grade " + student.getGrade());
		
	}
}

No comments:

Post a Comment

Followers