We are creating our own application for taking screenshots. It has an option to set a name for screenshot-file to be saved. If u | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

We are creating our own application for taking screenshots. It has an option to set a name for screenshot-file to be saved. If u

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner read = new Scanner(System.in); String name = read.next(); //screenshots ScreenShot screenshot1 = new ScreenShot(); ScreenShot screenshot2 = new ScreenShot(name); //outputting the names System.out.println(screenshot1.getName()); System.out.println(screenshot2.getName()); } } class ScreenShot{ private String name; //complete the first constructor ScreenShot( String name){ this.name = name; } //complete the second constructor ScreenShot(){ this.name = "Screenshot"; } //Setter public void setName(String name){ this.name = name; } //Getter public String getName(){ return name; } }

28th Oct 2021, 5:47 PM
Manish Kumar Shah
Manish Kumar Shah - avatar
2 Answers
0
So what is your doubt in this?
28th Oct 2021, 5:49 PM
Atul [Inactive]