Translate

New Live Courses

🚀 *Gen AI Engineer Telugu (Production Focused)*
🗓️ *Date:* 30th Sept 2026, 07:00AM IST
📝 *Register Now!:*
https://www.vlrt.in/gr
👥 *Join WA Community:*
https://www.vlrt.in/gw
💡*Course Content:*
https://www.vlrt.in/ai
▶️ *Demo Videos:*
https://www.vlrt.in/gv

🚀 *Service now Admin/ Development (ITSM)FREE Demo in Telugu*
🗓️ *Date:* 30th Sept 2026, 08:00AM IST
📝 *Register Now!:*
https://www.vlrt.in/7r
👥 *Join WA Community:*
https://www.vlrt.in/7w
💡*Course Content:*
https://www.vlrt.in/7c
▶️ *Demo Videos:*
https://www.vlrt.in/7v

🚀 *Vulnerability Management Training Demo*
🗓️ *Date:* 30th Sept 2026, 09:00 AM IST
📝*Register Now!:*
https://www.vlrt.in/vr
👥 *Join Community:*
https://www.vlrt.in/cw
💡 *Course Content:*
https://www.vlrt.in/vc
▶️ *Demo Videos:*
https://www.vlrt.in/Vm

Friday, 1 October 2021

Exercise Create Your own Class in GroovyScripting groovy traing videos in telugu 09

 Watch This Video

https://youtu.be/IorpSDUYw24

------------------------------------------------------------------------------------------------

[Exercise] Create Your own Class
In this exercise you are going to create your own class and start to think about what your class would contain. There is no 1 correct answer for this. Follow the rules and see what you come up with.

Create a class called Tweet
Add properties to this class.
What properties would be present in a class that holds information about a tweet
Think about what their data types would be
What methods would go in this class?
How about a constructor to create a new tweet.
How about methods to change some of your properties?
How about a toString method (or AST Transformation)
Create a script called Twitter.
In this script create one or more Tweets.
print the Tweet instances to the console (and have their string representations shown)
Bonus

Create a file called Tweet.groovy.
Inside this file create a class called Tweet (the one you created above)





@groovy.transform.ToString
class Tweet{
String username
String text
Integer retweets
Integer favorites
Date createdOn


public Tweet(String user, String tweet){

username=user
text=tweet
retweets=0
favorites=0
createdOn=new Date()
}

void addToRetweets(){
retweets=+1
}
void addToFavorite(){
favorites=+1
}
def whatsapp =new whatsapp("sudheer","Helomsg")
print whatsapp












No comments:

Post a Comment

Note: only a member of this blog may post a comment.