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

Wednesday, 6 October 2021

Object Oriented Programming Exercise in Groovy Scripting groovy training telugu 42

 Watch This Video

https://youtu.be/Q1utvq3c4QQ


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


[Exercise] What makes up a class
Tweet

We are going to create a class that represents a single tweet.
This is an exercise both about code and starting to think about what
goes into building a class. There is no right or wrong answer here 
so don't be afraid to build your class how you see fit. I will go 
over in the review what I was thinking about when I built mine but 
again my answer is not the right one. 

What properties and methods go into building a tweet class? 

Bonus Points
How could you extract mentions and hashtags from the post text? 


class Tweet{
String post
String username
Date postDateTime

private List favorites=[]
private List retweets=[]
private List mentions=[]
private List hashtags=[]

void favorite(String username){

favorites<<username

}

List getFavorites(){

favorites
}

void retweets(String username){
retweets << username
}
List getRetweets(){
retweets
}
}

Tweet tweet= new Tweet(post:"This Groovy Course is Awesome",username:"@therealdanvega",postDateTime:new Date())
println tweet

tweet.favorite("@ApacheGroovy")
tweet.retweet("@ApacheGroovy")
println tweet.getFavorites()
println tweet.getRetweets()

No comments:

Post a Comment

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