Wiki
FlickrLeetcode
  • 💞Artificial Intelligence
    • ⚙️Midjourney vs Stable Diffusion
    • ⚙️Creative QR Codes with ControlNet
      • ⚙️How to generate a QR Code
      • ⚙️Collect prompt
      • ⚙️clip skip
      • ⚙️AUTOMATIC1111
      • ⚙️Edge detection and human pose detection
    • ⚙️Stable Diffusion
    • ⚙️What is 'token' and 'turbo'?
    • ⚙️Today's learning--LangChain
      • ⚙️Prompt
    • ⚙️LLM Parameters Demystified
    • ⚙️What is Cohere playground?
    • ⚙️DALL-E
    • ⚙️How to use AI to learn something that you don't know?
    • ⚙️Diffusers
    • Boosting Algorithms in machine learning, part 1:AdaBoost
  • 💞GitHub
    • ✅How to add a issue of the code with GitHub?
    • ✅How to edit code?
    • ✅How to use GitHub Desktop
    • ✅How to review in GutHub?
  • 💞Lastest concepts for me
    • 🪅Pandas DataFrame
    • 🪅Choosing between loc and iloc
  • 💞Need to remember
    • 🔢An article for leetcode
    • 🉑two types of group work
    • 🍒What is hashtag#?
    • 🐝Week6_APD
    • 🦋API
    • 🎼BFF
  • 💞Python
    • 🐍argument & parameter
    • 🐍"{:.2f}"
    • 🐍Timeit in Python
    • 🐍Today's learning--Pylint
    • 🐍Split and Strip in Python
    • 🐍Getter and Setter in Python
    • 🐍"import json" in Python
    • 🐍Open CSV file in Python
    • 🐍print(f"An error occurred: {e}")
  • Page
  • 🪅command-line
  • 💞DataVisualization
    • 🪅How to choose plot type
  • 💞DataCleaning
    • 🪅Some basic code of data_cleaning
  • 💞Java
    • 🍡difference use between ArrayList and HashMap in Java
    • 🍡ArrayList & LinkedList
    • 🍡assertFalse(App.checkInputNumber(1,0))
      • 🍡HashSet
    • 🍡iterator
    • 🍡Java concept of assignment 1
    • 🍡Week6_Java
    • 🍡serializable
  • 💞Mark something that easily to forget
    • 🙉Mark something
    • 🙉How to edit cover picture from "Flickr" using "URL" in GitBook?
  • 💞VS Code
    • ✖️Install a project in VS Code
    • ✖️What should do after editing the code of one branch?
    • ✖️How to create a branch in VS code?
    • ✖️How to debug?
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
  1. Java

Week6_Java

interface

To define an interface in Java, you use the interface keyword instead of class. An interface contains method signatures but no method bodies.

Interfaces define functionality that classes can implement. To implement an interface, a class uses the implements keyword:

public class Dog implements Animal {

  @Override
  public void makeSound() {
    System.out.println("Bark!");
  }

  @Override
  public void eat() {
    System.out.println("The dog is eating"); 
  }

}

Implementing classes must override all methods declared in the interface and provide implementations for them. Interfaces allow for abstraction in Java since they define behaviors that classes can implement in different ways.

Some key properties of Java interfaces:

  • Interface methods are implicitly public and abstract (no body)

  • Variables defined in an interface are public, static and final by default

  • A class can implement multiple interfaces using comma separation

  • An interface can extend other interfaces

So in summary, interfaces define a contract that implementing classes must follow. This allows for abstraction and polymorphism.

week6_java_tutorial

maturals is in week9's lecture

tutorial week10: java database: everytime you make some changes. You should go to database(sql) to file->write change

PreviousJava concept of assignment 1Nextserializable

Last updated 1 year ago

Was this helpful?

💞
🍡