package com.firstproject.getset;
public class GetSet {
private int intVariable;
private double doubleVariable;
private String stringVariable;
public int getIntVariable(){
return intVariable;
}
public void setIntVariable(int newIntVariable){
intVariable = newIntVariable;
}
public double getDoubleVariable(){
return doubleVariable;
}
public void setDoubleVariable(double newDoubleVariable){
doubleVariable = newDoubleVariable;
}
public String getStringVariable(){
return stringVariable;
}
public void setStringVariable(String newStringVariable){
stringVariable = newStringVariable;
}
public void message(){
System.out.println("Int variable = "+intVariable+
"\nDouble variable = "+doubleVariable+
"\nString variable = "+"\""+stringVariable+"\"");
}
}
import java.io.*;
import com.firstproject.getset.*;
public class Main{
public static void main(String[] args){
GetSet getset = new GetSet(Reader);
getset.setIntVariable(1);
getset.setDoubleVariable(6.66);
getset.setStringVariable("Hello, World!");
getset.message();
}
}
import java.io.*;
import com.firstproject.getset.*;
public class Main{
public static void main(String[] args){
GetSet getset = new GetSet(InputStreamReader(System.in));
getset.setIntVariable = getset.readLine();
getset.setDoubleVariable = getset.readLine();
getset.setStringVariable = getset.readLine();
getset.message();
}
}
import java.io.BufferedReader;
import java.io.Reader;
public class GetSet extends BufferedReader {
private int intVariable;
private double doubleVariable;
private String stringVariable;
public GetSet(Reader in, int sz) {
super(in, sz);
}
public GetSet(Reader in) {
super(in);
}
public int getIntVariable() {
return intVariable;
}
public void setIntVariable(int newIntVariable) {
intVariable = newIntVariable;
}
public double getDoubleVariable() {
return doubleVariable;
}
public void setDoubleVariable(double newDoubleVariable) {
doubleVariable = newDoubleVariable;
}
public String getStringVariable() {
return stringVariable;
}
public void setStringVariable(String newStringVariable) {
stringVariable = newStringVariable;
}
public void message() {
System.out.println("Int variable = " + intVariable +
"\nDouble variable = " + doubleVariable +
"\nString variable = " + "\"" + stringVariable + "\"");
}
}
getset.setIntVariable = getset.readLine();
getset.setIntVariable(Integer.parseInt(getset.readLine()));
public void setIntVariable(String s) {
intVariable = Integer.parseInt(s);
}