How to change the TextView from an object? - java

How can I use this to change the profile of a Turtle using Radio buttons? So when user selects a radio button different text should be displayed in the TextView. How can I set these objects? Currently there is no output displaying when the radio button is clicked. So I would like to get the details of the turtle from the object and set it.
//Main Activity
public class MainActivity extends AppCompatActivity {
private RadioGroup group_turtle;
private ImageView image_turtle;
private TextView text_description;
//create an array to store the turtle's profile
ArrayList<Turtle> turtles = new ArrayList<>(4);
//OnCreate method
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Load GUI components
loadGUI();
processRadioButtons();
loadTurtles();
}
private void loadTurtles() {
Turtle t1 = new Turtle("Leo","Leo is the heart of the team.",
"Loyal, brave, and responsible, Leonardo is the team leader, but not by choice.",
5);
Turtle t2 = new Turtle("Mike","Mikey is the jokester.",
"Slice of pizza in hand and shouts of \"COWABUNGA!\"",
4);
Turtle t3 = new Turtle("Don","Donny is the thinker.",
"Every team needs a brain, and for the Turtles, that's Donny. He's smart and philosophical.",
5);
Turtle t4 = new Turtle("Raphael","Raphael is fearless.",
"Raphael has the confidence and charisma of a \"D\" personality",
4);
//add the t1-t4 to the turtle list
turtles.add(t1);
turtles.add(t2);
turtles.add(t3);
turtles.add(t4);
/*try to display the turtle details in the logcat
for (Turtle t:turtles) {
Log.d("TURTLE", t.toString());
}*/
}
private void changeTurtle(int index) {
int images[] = {
R.drawable.tmntleo,
R.drawable.tmntmike,
R.drawable.tmntdon,
R.drawable.tmntraph};
//change the turtle image using setImageresource
image_turtle.setImageResource(images[index]);
//change the turtle profile
//I'm trying to change the Turtle's text description in here which is the textview.
String t1 = text_description.getText().toString();
text_description.setText(t1);
}
private void processRadioButtons() {
//set the listener
group_turtle.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
#Override
public void onCheckedChanged(RadioGroup radioGroup, int id) {
switch (id) {
case R.id.radio_leo:
MainActivity.this.changeTurtle(0);
break;
case R.id.radio_mike:
MainActivity.this.changeTurtle(1);
break;
case R.id.radio_don:
MainActivity.this.changeTurtle(2);
break;
case R.id.radio_raph:
MainActivity.this.changeTurtle(3);
break;
}
}
});
}
private void loadGUI() {
group_turtle = findViewById(R.id.radio_group);
image_turtle = findViewById(R.id.imageView);
text_description = findViewById(R.id.text_description);
}
}
package com.example.ninjaturtle;
// new Turtle class
public class Turtle {
private String name;
private String features;
private String description;
private int rating;
//constructor
/*public Turtle(String name, String features, String description, int rating) {
this.name = name;
this.features = features;
this.description = description;
this.rating = rating;
}*/
//setter & getter
/*public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFeatures() {
return features;
}
public void setFeatures(String features) {
this.features = features;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public int getRating() {
return rating;
}
public void setRating(int rating) {
this.rating = rating;
}
//toString method
#Override
public String toString() {
return "Turtle{" +
"name='" + name + '\'' +
", description='" + description + '\'' +
'}';
}*/
}

Change String t1 = text_description.getText().toString();
to
String desc= turtles.get(index).getDescription();
or to print all data
String desc= turtles.get(index).toString();
in your changeTurtle() method

Related

Binding data into activity

How to bind data into my activity, so that every item will be with correct text. I was following the tutorial but, it only shows how to load the image. Iwas trying with item.getTitle().into(titleorg); but got some errors
Thats my details activity
public class OrgDetails extends AppCompatActivity {
ImageView imgorg;
TextView titleorg, descorg;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_org_details);
this.imgorg = findViewById(R.id.item_org_logo);
this.titleorg = findViewById(R.id.item_org_title);
this.descorg = findViewById(R.id.item_org_description);
Org item = (Org) getIntent().getExtras().getSerializable("orgObject");
loadOrgData(item);
}
private void loadOrgData(Org item) {
Glide.with(this).load(item.getDrawableResource()).into(imgorg);
}
Thats my model
public class Org implements Serializable {
private String title, description;
private int drawableResource;
public Org(int drawableResource) {
this.drawableResource = drawableResource;
}
public Org(String title, String description, int drawableResource) {
this.title = title;
this.description = description;
this.drawableResource = drawableResource;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public int getDrawableResource() {
return drawableResource;
}
public void setDrawableResource(int drawableResource) {
this.drawableResource = drawableResource;
}

URL based Movie Streaming App , need help in passing variable strings from one class to another

I would like to call the value of the String streamingLink to
String path1 ="xxxxx"; on MoviePlayerActivity.class (mentioned below)
Instead of xxxx, I need it to be the movie URL
Also, each movie has different URL stored inside an Array of List in DataSources.class
public class Movie {
private String title;
private String description;
private int thumbnail;
private int coverPhoto;
private String imdb;
private String rt;
private String streamingLink;
//Cast Initializing
private int cast1;
private int cast2;
private int cast3;
private String actor1;
private String actor2;
private String actor3;
public Movie(String title, int thumbnail, int coverPhoto, String actor1, int cast1, String actor2, int cast2, String actor3, int cast3, String streamingLink, String imdb, String rt, String description) {
this.title = title;
this.thumbnail = thumbnail;
this.coverPhoto = coverPhoto;
this.description =description;
this.imdb = imdb;
this.rt = rt;
this.streamingLink = streamingLink;
// Cast
this.cast1 = cast1;
this.cast2 = cast2;
this.cast3 = cast3;
this.actor1 = actor1;
this.actor2 = actor2;
this.actor3 = actor3;
}
public int getCoverPhoto() {
return coverPhoto;
}
public String getTitle() {
return title;
}
public String getDescription() {
return description;
}
public int getThumbnail() {
return thumbnail;
}
public String getImdb() {
return imdb;
}
public String getRt() {
return rt;
}
//Cast get activity
public int getCast1() {
return cast1;
}
public int getCast2() {
return cast2;
}
public int getCast3() {
return cast3;
}
public String getActor1() {
return actor1;
}
public String getActor2() {
return actor2;
}
public String getActor3() {
return actor3;
}
public String getStreamingLink() {
return streamingLink;
}
public void setTitle(String title) {
this.title = title;
}
public void setCoverPhoto(int coverPhoto) {
this.coverPhoto = coverPhoto;
}
public void setDescription(String description) {
this.description = description;
}
public void setThumbnail(int thumbnail) {
this.thumbnail = thumbnail;
}
public void setImdb(String imdb) {
this.imdb = imdb;
}
public void setRt(String rt) {
this.rt = rt;
}
public void setStreamingLink(String streamingLink) {
this.streamingLink = streamingLink;
}
//Cast set activity
public void setCast1(int cast1) {
this.cast1 = cast1;
}
public void setActor1(String actor1) {
this.actor1 = actor1;
}
public void setCast2(int cast2) {
this.cast2 = cast2;
}
public void setActor2(String actor2) {
this.actor2 = actor2;
}
public void setCast3(int cast3) {
this.cast3 = cast3;
}
public void setActor3(String actor3) {
this.actor3 = actor3;
}
}
MoviePlayerActivity:
public class MoviePlayerActivity extends AppCompatActivity {
private PlayerView playerView;
FloatingActionButton play_fab;
private SimpleExoPlayer simpleExoPlayer;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate( savedInstanceState );
setFullScreen();
setContentView( R.layout.activity_movie_player );
hideActionbar();
iniExoPlayer();
}
private void hideActionbar() {
getSupportActionBar().hide();
}
private void setFullScreen() {
requestWindowFeature( Window.FEATURE_NO_TITLE );
getWindow().setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN );
}
private void iniExoPlayer() {
playerView=findViewById( R.id.movie_exo_player );
simpleExoPlayer = ExoPlayerFactory.newSimpleInstance( this );
playerView.setPlayer( simpleExoPlayer );
String path1 ="xxxxx";
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory( this,
Util.getUserAgent(this,"appname"));
MediaSource videoSource = new ExtractorMediaSource.Factory(dataSourceFactory )
.createMediaSource( Uri.parse( path1) );
simpleExoPlayer.prepare( videoSource );
simpleExoPlayer.setPlayWhenReady( true );
}
#Override
protected void onDestroy() {
super.onDestroy();
simpleExoPlayer.release();
}
}
Here's how the array looks like
this is class DataSource
public static List getEnglishMovies(){
List<Movie> lstMovies = new ArrayList<>();
lstMovies.add( new Movie( "Avengers: Endgame" , R.drawable.avgendgame, R.drawable.avgendgamecp,"Chris Hemsworth",R.drawable.chrishemsworth,"Robert Downey Jr.",R.drawable.downeyjr,"Chris Hemswoth",R.drawable.chrishemsworth,"http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4","8.4","NA","After the devastating events of Avengers: Infinity War (2018), the universe is in ruins. With the help of remaining allies, the Avengers assemble once more in order to reverse Thanos' actions and restore balance to the universe.") );
lstMovies.add( new Movie( "Extraction" ,R.drawable.extraction, R.drawable.extractioncp,"Chris Hemswoth",R.drawable.chrishemsworth,"Chris Hemswoth",R.drawable.chrishemsworth,"Chris Hemswoth",R.drawable.chrishemsworth,"http://168.61.51.210/movies/Extraction.mp4","6.8","68%","Tyler Rake, a fearless black market mercenary, embarks on the most deadly extraction of his career when he's enlisted to rescue the kidnapped son of an imprisoned international crime lord.") );
lstMovies.add( new Movie( "The Call Of The Wild" ,R.drawable.thecallofthewildjpg,R.drawable.thecallofthewildcp,"Chris Hemswoth",R.drawable.chrishemsworth,"Chris Hemswoth",R.drawable.chrishemsworth,"Chris Hemswoth",R.drawable.chrishemsworth,"http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4","6.8","62%", "Adapted from the beloved literary classic, THE CALL OF THE WILD vividly brings to the screen the story of Buck, a big-hearted dog whose blissful domestic life is turned upside down when he is suddenly uprooted from his California home and transplanted to the exotic wilds of the Alaskan Yukon during the Gold Rush of the 1890s. As the newest rookie on a mail delivery dog sled team--and later its leader--Buck experiences the adventure of a lifetime, ultimately finding his true place in the world and becoming his own master.") );
lstMovies.add( new Movie( "Do Little" ,R.drawable.dolittle, R.drawable.dolittlecp,"Chris Hemswoth",R.drawable.chrishemsworth,"Chris Hemswoth",R.drawable.chrishemsworth,"Chris Hemswoth",R.drawable.chrishemsworth,"http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4","5.6","NA","A physician who can talk to animals embarks on an adventure to find a legendary island with a young apprentice and a crew of strange pets.") );
return lstMovies;
}

Add custom markers to google maps from geopints stored on firebase

Excuse my ignorance but I am very new to Android Studio and Java. I have adapted a lot the following code from another course to my needs, but it is not working.
I am trying to add custom markers to my Google maps Android app. Lhe locations of the markers are stored as geopoints on firebase. I have attempted to do so using cluster marker. The app crashes immediately when I attempt to run it with the following shortened error.
java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.firebase.firestore.CollectionReference com.google.firebase.firestore.FirebaseFirestore.collection(java.lang.String)' on a null object reference
at com.codingwithmitch.googlemaps2018.ui.MapsActivity.addMapMarkers(MapsActivity.java:400)
at com.codingwithmitch.googlemaps2018.ui.MapsActivity.onMapReady(MapsActivity.java:486)
I am attempting to display every geopoint in the Stop Locations Collection
I cannot screen shot my firebase but it looks as follows:
Collection
"Stop Locations">>>>>Documents
"KzDQ2sITZ3O8GEoZgp0I",...etc >>>>>Fields
Geo:""
Name:""
avatar:""
loc_id""
If I were to guess I would say the mLocationInformations is empty, probably originating from here >> mLocationInformations.add(document.toObject(LocationInformation.class))
code from MapsActivity:
private ClusterManager<ClusterMarker> mClusterManager;
private MyClusterManagerRenderer mClusterManagerRenderer;
private ArrayList<ClusterMarker> mClusterMarkers = new ArrayList<>();
private LocationInformation mLocationInformation;
private ArrayList<LocationInformation> mLocationInformations = new ArrayList<>();
private void addMapMarkers(){
CollectionReference locationsRef = mDb
.collection("Stop Locations");
locationsRef.get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
#Override
public void onComplete(#NonNull Task<QuerySnapshot> task) {
if(task.isSuccessful()){
for (QueryDocumentSnapshot document : task.getResult()) {
mLocationInformations.add(document.toObject(LocationInformation.class));
}
} else {
Log.d(TAG, "Error getting documents: ", task.getException());
}
}
});
if(mMap != null){
if(mClusterManager == null){
mClusterManager = new ClusterManager<ClusterMarker>(this.getApplicationContext(), mMap);
}
if(mClusterManagerRenderer == null){
mClusterManagerRenderer = new MyClusterManagerRenderer(
this,
mMap,
mClusterManager
);
mClusterManager.setRenderer(mClusterManagerRenderer);
}
for(LocationInformation locationInformation: mLocationInformations){
Log.d(TAG, "addMapMarkers: location: " + locationInformation.getGeo().toString());
try{
String snippet = "";
snippet = "";
int avatar = R.drawable.cartman_cop; // set the default avatar
try{
avatar = Integer.parseInt(locationInformation.getAvatar());
}catch (NumberFormatException e){
Log.d(TAG, "addMapMarkers: no avatar ");
}
ClusterMarker newClusterMarker = new ClusterMarker(
new LatLng(locationInformation.getGeo().getLatitude(), locationInformation.getGeo().getLongitude()),
//locationInformation.getName().getUsername(),
locationInformation.getLoc_id(),
snippet,
avatar,
locationInformation.getName()
);
mClusterManager.addItem(newClusterMarker);//adding to the map
mClusterMarkers.add(newClusterMarker);//making an easy access array list
}catch (NullPointerException e){
Log.e(TAG, "addMapMarkers: NullPointerException: " + e.getMessage() );
}
}
mClusterManager.cluster();
}
}
#Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
if(mLocationPermissionGranted){
getDeviceLocation();
}else{
Toast.makeText(this, "mLocationpermission denied at origin", Toast.LENGTH_SHORT).show();
}
addMapMarkers();
}
}
LocationInfromation.java
import com.google.firebase.firestore.GeoPoint;
public class LocationInformation {
private String Name;
private GeoPoint Geo;
private String avatar;
private String loc_id;
public LocationInformation(String Name, GeoPoint Geo, String avatar, String loc_id) {
this.Name = Name;
this.Geo = Geo;
this.avatar = avatar;
this.loc_id = loc_id;
}
public LocationInformation(){
}
public String getLoc_id() {
return loc_id;
}
public void setLoc_id(String loc_id) {
this.loc_id = loc_id;
}
public Double getLongitude() {
return longitude;
}
public void setLongitude(Double longitude) {
this.longitude = longitude;
}
private Double longitude;
public String getName() {
return Name;
}
public void setName(String name) {
this.Name = Name;
}
public GeoPoint getGeo() {
return Geo;
}
public void setGeo(GeoPoint geo) {
this.Geo = Geo;
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
#Override
public String toString() {
return "LocationInformation{" +
"Name=" + Name +
", Geo=" + Geo +
", avatar='" + avatar +
", loc_id='" + loc_id +
'}';
}
}
ClusterMArker.java
import com.google.android.gms.maps.model.LatLng;
import com.google.maps.android.clustering.ClusterItem;
public class ClusterMarker implements ClusterItem {
private LatLng position; // required field
private String title; // required field
private String snippet; // required field
private int iconPicture;
private String name;
public ClusterMarker(LatLng position, String title, String snippet, int iconPicture, String name) {
this.position = position;
this.title = title;
this.snippet = snippet;
this.iconPicture = iconPicture;
this.name = name;
}
public ClusterMarker() {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getIconPicture() {
return iconPicture;
}
public void setIconPicture(int iconPicture) {
this.iconPicture = iconPicture;
}
public void setPosition(LatLng position) {
this.position = position;
}
public void setTitle(String title) {
this.title = title;
}
public void setSnippet(String snippet) {
this.snippet = snippet;
}
public LatLng getPosition() {
return position;
}
public String getTitle() {
return title;
}
public String getSnippet() {
return snippet;
}
}
[enter image description here][1]
To solve this, please add the following line of code:
FirebaseFirestore mDb = FirebaseFirestore.getInstance();
Right before this line:
CollectionReference locationsRef = mDb.collection("Stop Locations");
So your FirebaseFirestore object is initialized correctly.

Method getParcelableExtra() returns null when creating an intent

I have a problem regarding the creation of an intent and the handover of an object with the getParcelableExtra() method to it.
The aim of the project is the creation of a recycler view. If an item from the recycler is selected a new intent gets started and should display more detailed data.
Because the data is fetched from an external MySQL DB I'm using Volley for most of the networking stuff.
The recycler is implemented inside the Volley onResponse() method which is first called at app start (onCreate). Until this point everything works fine and the recycler is loaded and displayed correctly.
public class UserAreaActivity extends AppCompatActivity{
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_area);
initializeRecycler();
}
public void initializeRecycler() {
operations.getFoodFromDB(getFoodID(), new IDatabaseOperations() {
#Override
public void onSuccess(final ArrayList<Food> food_list) {
mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
mLayoutmanager = new LinearLayoutManager(UserAreaActivity.this);
mAdapter = new FoodAdapter(food_list);
mRecyclerView.setLayoutManager(mLayoutmanager);
mRecyclerView.setAdapter(mAdapter);
mAdapter.setOnItemClickListener(new FoodAdapter.OnItemClickListener() {
#Override
public void OnItemClick(int position) {
Intent intent = new Intent(UserAreaActivity.this, FoodProfile.class);
GETS CORRECT OBJECT----->intent.putExtra("food", food_list.get(position));
startActivity(intent);
}
});
}
});
}
}
As you see I created an interface for the Volley onResponse method called onSuccess. Inside this method I am creating an onItemClickListener and this is where it gets ugly.
The onItemClickListener opens up the more detailed view of the item, but the method getParcelableExtra() returns NULL. Whatever I do it never returns an object of the class Food.
public class FoodProfile extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(activity_food_profile);
Food food = getIntent().getParcelableExtra("food");<----RETURNS NULL
String price = food.getPrice();
String name = food.getName();
String rating = ((Float)food.getRating()).toString();
String imageRes = food.getmimgId();
TextView mPrice = (TextView) findViewById(R.id.Price);
mPrice.setText(price);
TextView mName = (TextView) findViewById(R.id.Name);
mName.setText(name);
TextView mRating = (TextView) findViewById(R.id.Rating);
mRating.setText(rating);
}
}
So the putExtra() works as intended and gets the correct object of the food class. But getParcelableExtra() returns NULL everytime. So no value is displayed in the started intent.
Food class:
public class Food implements Parcelable {
public int id;
public String name;
public String category;
public String date;
public int vegan;
public int vegetarian;
public String price;
public String uuid;
public float rating;
public String mimgId;
public Food(int id, String name, String category, int vegan, int vegetarian, String price, String uuid, float rating, String mimgId){
this.id = id;
this.name = name;
this.category = category;
this.date = date;
this.vegan = vegan;
this.vegetarian = vegetarian;
this.price = price;
this.uuid = uuid;
this.rating = rating;
this.mimgId = mimgId;
}
protected Food(Parcel in) {
id = in.readInt();
name = in.readString();
category = in.readString();
date = in.readString();
vegan = in.readInt();
vegetarian = in.readInt();
price = in.readString();
uuid = in.readString();
rating = in.readFloat();
mimgId = in.readString();
}
public static final Creator<Food> CREATOR = new Creator<Food>() {
#Override
public Food createFromParcel(Parcel in) {
return new Food(in);
}
#Override
public Food[] newArray(int size) {
return new Food[size];
}
};
public int getId() {
return id;
}
public String getName() {
if(name != null) {
name = name.replaceAll(System.getProperty("line.separator"), (""));
}
return name;
}
public String getDate() {
return date;
}
public int isVegan() {
return vegan;
}
public int isVegetarian() {
return vegetarian;
}
public String getPrice() {
return price;
}
public String getUuid() {
return uuid;
}
public float getRating(){return rating;}
public String getmimgId() {
return mimgId;
}
#Override
public int describeContents() {
return 0;
}
#Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(price);
dest.writeString(name);
dest.writeString(((Float)rating).toString());
dest.writeString(mimgId);
}
}
Has anyone an idea whats causing the getParcelableExtra() to return null?
Thanks for your help in advance!
As I commented above, the writeToParcel() is problematic. The parcel should be written and read in the same order.
Please refer to the following pages as reference:
What is Parcelable in android
Using Parcelable
Understanding Androids Parcelable - Tutorial

How to get variables from an object?

I am creating image_details in a customlistadapter. During this adapter the variable Answer is set of each item. Through debugger I'm seeing that I have the data in the place where I need it, but I don't know how to access it:
Debugger image:
Here you can see I have 6 questions which each has the variable int Answer (open one is set to 0). I want to request the Answer of each item(All 6) when I press save:
SaveButton = ((Button) rootView.findViewById(R.id.Save));
SaveButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Object c = image_details.get(1);
}
});
What should I place in the onClick to retrieve this data?
This is my QuestionItem class:
public class QuestionItem {
private String Question;
private String Answer1;
private String Answer2;
private String Answer3;
private String Answer4;
private int Answer;
private String[] Answers;
public String getQuestion() {
return Question;
}
public void setQuestion(String Question) {
this.Question = Question;
}
public String Getanswer1() {
return Answer1;
}
public void setAnswer1(String Answer1) {
this.Answer1 = Answer1;
}
public String Getanswer2() {
return Answer2;
}
public void setAnswer2(String Answer2) {
this.Answer2 = Answer2;
}
public String Getanswer3() {
return Answer3;
}
public void setAnswer3(String Answer3) {
this.Answer3 = Answer3;
}
public String Getanswer4() {
return Answer4;
}
public void setAnswer4(String Answer4) {
this.Answer4 = Answer4;
}
public int GetAnswer() {
return Answer;
}
public void setAnswer(int Answer) {
this.Answer = Answer;
}
}
use instance variables. Heres an example
public class Employee{
// this instance variable is visible for any child class.
public String name;
// salary variable is visible in Employee class only.
private double salary;
// The name variable is assigned in the constructor.
public Employee (String empName){
name = empName;
}
// The salary variable is assigned a value.
public void setSalary(double empSal){
salary = empSal;
}
// This method prints the employee details.
public void printEmp(){
System.out.println("name : " + name );
System.out.println("salary :" + salary);
}
public static void main(String args[]){
Employee empOne = new Employee("Ransika");
empOne.setSalary(1000);
empOne.printEmp();
}
}

Categories

Resources