Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

java comparable<> code example

Example: comparable interfacee

class Student implements Comparable<Student>{  
int rollno;  
String name;  
int age;  
Student(int rollno,String name,int age){  
this.rollno=rollno;  
this.name=name;  
this.age=age;  
}  
  
public int compareTo(Student st){  
if(age==st.age)  
return 0;  
else if(age>st.age)  
return 1;  
else  
return -1;  
}  
}

Tags:

Java Example

Related

gson java code example simulating final class code example asp net c# compare date to current datetime code example install unity android module code example detecting mouse clicks pygame code example Failed to compile. ./src/pages/Routes/Routes.js Module not found: Can't resolve 'react-router-dom' in 'C:\Users\krist\OneDrive\Desktop\Git_Projects\ConnectMe\src\pages\Routes' code example javascript to make my navbar responsive code example why cant we use accuracy in regression code example how to disable copy content from website code example Encountered internal error running command: Error: Neither ANDROID_HOME nor ANDROID_SDK_ROOT environment variable was exported. Read https://developer.android.com/studio/command-line/variables for more details code example adding a column in mysql code example crypto browser code example

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy