answersLogoWhite

0

What is a public name?

Updated: 12/15/2022
User Avatar

Wiki User

10y ago

Want this question answered?

Be notified when an answer is posted

Add your answer:

Earn +20 pts
Q: What is a public name?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How do you create a java bean class named student with the following attributes student id name place contact number create getters and setters for these attributes?

public class Student { private int id; private String name; private String place; private int contact; public Student(){ } public Student(String studentName, int studentId){ name = studentName; id = studentId; } public int getId(){ return id; } public String getName(){ return name; } public String getPlace(){ return place; } public int getContact(){ return contact; } public void setId(int studentId){ id = studentId; } public void setName(String studentName){ name = studentName; } public void setPlace(String studentPlace){ place = studentPlace; } public void setContact(int studentContact){ contact = studentContact; }


The name of a Java program file must match the name of the class with the extension java?

not exactly..... only If your class is public then the java program name should be the public class name with extension Sample.java >> public class Sample { public static void main(String[] args) { ..... } } NonPublicClass.java class SomeOtherName { ......... }


Is it possible to have more than one public class in the same file?

No. There can be multiple java classes in the same .java file, but the name of the file must match the name of the public class in the file.


What is public static final variable in java?

-Public to all - Static to access with Class Name - Final to change( constant and not alowed to change) Just use it along with class name. (As implied above, a 'public static final' variable in Java is what other languages would call a Constant. )


What are the coding standards used in java to name a class?

To name a class, you simply need an access specifier, sometimes the word "static" or "abstract" (only if applicable), the word "class", and a class name. The body of the class is then contained in brackets. Example: public class Empty{} "public" is the access specifier (public is also default, and thus really unnecessary), and "Empty" is the class name. It is common to capitalize the first letter of the class name, as well as the first letter of each word if the name is made of several words concatenated together.