Answers for "constructor Overriding in java"

0

constructor overloading in java

class Student{
	private String stuname;
	private String stuid;
	private int stuage;

	Student(){
		System.out.println("this a default constructor");
		
	}
	Student(String stuname,String stuid,int stuage){
		this.stuname=stuname;
		this.stuid=stuid;
		this.stuage=stuage;
	}

	public String getStudentName(){
		return stuname;
	}
	public String getStudentId(){
		return stuid;
	}
	public int getStudentAge(){
		return stuage;
	}

}

public class Constructor_OverloadingExample{
	public static void main(String[] args){
		Student stu=new Student();//calling the default constructor
		Student student=new Student("Khubaib","CSC-17F-129",22);//calling a parameterized constructor with sets the value of parameters
		System.out.println("Student Name: "+student.getStudentName());
		System.out.println("Student ID: "+student.getStudentId());
		System.out.println("Student Age: "+student.getStudentAge());


	}
}
Posted by: Guest on August-25-2021
0

method override

using method-override in your index.js
1. npm install method-override --save
2. var methodOverride = require("method-override");
3. app.use(methodOverride("_method"));
//'_method' is what methodOverride will look for
method override in your UPDATE route: 
* <form action = "/campgrounds/<%=campground._id%>/edit?_method=PUT" 
	method = "POST">
and EDIT routes:
Posted by: Guest on July-17-2020

Code answers related to "constructor Overriding in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language