Answer to Question #239311 in Java | JSP | JSF for Tarurendra Kushwah

Question #239311

Create a Mobile class with properties, which can be set once while creating object using constructor arguments. Create  getProperties() methods which are having public access modifiers.


1
Expert's answer
2021-09-21T02:14:57-0400
import java.util.Scanner;
public class Main
{
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		System.out.println("Enter properties:");
		String pr=in.next();
		
		Mobile m=new Mobile(pr);
		System.out.println(m.getProperties());
	}
}


class Mobile{
    private String properties;
    
    public Mobile(String p){
        properties=p;
    }
    String getProperties(){
        return properties;
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS