Kunchum telugulo ardhamaiyetatlu chepochuga bro Telugu channel ani pettukunnav ani open chesa But ardhamindhele gane Some words Telugulo chepthe bagundu ani anthe Overall good Thank you ANNA
// Single program demonstrating MVC architecture public class MVCExample {
// Model class static class Student { private String name; private int rollNo; // Constructor public Student(String name, int rollNo) { this.name = name; this.rollNo = rollNo; } // Getters and Setters public String getName() { return name; } public void setName(String name) { this.name = name; } public int getRollNo() { return rollNo; } public void setRollNo(int rollNo) { this.rollNo = rollNo; } } // View class static class StudentView { public void printStudentDetails(String studentName, int studentRollNo) { System.out.println("Student Details:"); System.out.println("Name: " + studentName); System.out.println("Roll No: " + studentRollNo); } } // Controller class static class StudentController { private Student model; private StudentView view; // Constructor public StudentController(Student model, StudentView view) { this.model = model; this.view = view; } // Updates the model's name public void setStudentName(String name) { model.setName(name); } // Fetches the model's name public String getStudentName() { return model.getName(); } // Updates the model's roll number public void setStudentRollNo(int rollNo) { model.setRollNo(rollNo); } // Fetches the model's roll number public int getStudentRollNo() { return model.getRollNo(); } // Updates the view with model's data public void updateView() { view.printStudentDetails(model.getName(), model.getRollNo()); } } // Main method public static void main(String[] args) { // Initialize the Model Student model = new Student("John Doe", 101); // Initialize the View StudentView view = new StudentView(); // Initialize the Controller StudentController controller = new StudentController(model, view); // Display initial data controller.updateView(); // Modify model data via the controller controller.setStudentName("Jane Smith"); controller.setStudentRollNo(202); // Display updated data controller.updateView(); } }
Thank you sir it's help us
Kunchum telugulo ardhamaiyetatlu chepochuga bro
Telugu channel ani pettukunnav ani open chesa
But ardhamindhele gane
Some words Telugulo chepthe bagundu ani anthe
Overall good
Thank you ANNA
Ok thank you
Example program ivvandi sir
// Single program demonstrating MVC architecture
public class MVCExample {
// Model class
static class Student {
private String name;
private int rollNo;
// Constructor
public Student(String name, int rollNo) {
this.name = name;
this.rollNo = rollNo;
}
// Getters and Setters
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getRollNo() {
return rollNo;
}
public void setRollNo(int rollNo) {
this.rollNo = rollNo;
}
}
// View class
static class StudentView {
public void printStudentDetails(String studentName, int studentRollNo) {
System.out.println("Student Details:");
System.out.println("Name: " + studentName);
System.out.println("Roll No: " + studentRollNo);
}
}
// Controller class
static class StudentController {
private Student model;
private StudentView view;
// Constructor
public StudentController(Student model, StudentView view) {
this.model = model;
this.view = view;
}
// Updates the model's name
public void setStudentName(String name) {
model.setName(name);
}
// Fetches the model's name
public String getStudentName() {
return model.getName();
}
// Updates the model's roll number
public void setStudentRollNo(int rollNo) {
model.setRollNo(rollNo);
}
// Fetches the model's roll number
public int getStudentRollNo() {
return model.getRollNo();
}
// Updates the view with model's data
public void updateView() {
view.printStudentDetails(model.getName(), model.getRollNo());
}
}
// Main method
public static void main(String[] args) {
// Initialize the Model
Student model = new Student("John Doe", 101);
// Initialize the View
StudentView view = new StudentView();
// Initialize the Controller
StudentController controller = new StudentController(model, view);
// Display initial data
controller.updateView();
// Modify model data via the controller
controller.setStudentName("Jane Smith");
controller.setStudentRollNo(202);
// Display updated data
controller.updateView();
}
}