Joke Collection Website - Mood Talk - JAVA questions are very simple, newbies get points, wait online
JAVA questions are very simple, newbies get points, wait online
First write down what I changed:
interface Phone
{
public abstract void call();
public abstract void listen();
}
abstract class Mobile implements Phone
{
public abstract void sendMes ();
public abstract void acptMes();
}
class MobilePhone extends Mobile
{
public void call()
{
System.out.println("Implement the first method");
}
public void listen()
{
System.out.println("Implement the second method");
}
public void sendMes()
{
System.out.println("I am the third one");
}
public void acptMes()
{
System.out.println("The fourth one is also implemented~~");
}
}
public class Wb6
{
public static void main(String[] asdmhsadjya)
{
p>
MobilePhone a = new MobilePhone();
a.call();
a.listen();
a.sendMes( );
a.acptMes();
}
}
The execution result is:
Implementation The first method
Implement the second method
I am the third one
The fourth method is also implemented~~
Then let’s talk about the problems with the program you wrote.
First, you wrote System as Systme. I don’t know how you wrote the program when you wrote it. This is the most taboo thing when writing a program. It should be There is a rigorous thought and practice.
Second, when you define the interface, use this method: interface Pone
It is also recommended that you use a compiler to write the program. Now The one I use more often is Eclipse, which is easier to use. You can download the latest English version at http://www.eclipse.org/.
Finally, I also wrote something that a good programmer should do. of:
1. Solid foundation. Data structures, discrete mathematics, and compilation principles are the basis of all computer science. If you don't master them, it will be difficult to write high-level programs. According to my observation, people majoring in computer science are better able to write high-quality software than those majoring in other majors. Everyone can write programs, but when you find that it is difficult to improve after a certain level of writing, you should think about whether you should go back and learn these most basic theories.
Don't learn OOP from the beginning. Even if you are proficient in OOP, you may be at a loss when encountering some basic algorithms.
2. Rich imagination. Don't stick to a fixed way of thinking. When you encounter a problem, think of several solutions to the problem and try methods that others have never thought of. Rich imagination is based on rich knowledge. In addition to computers, people often dabble in other subjects, such as astronomy, physics, mathematics, etc. In addition, watching more science fiction movies is also a good way.
3. The simplest is the best. This may be a rule that all science follows. In Einstein's eyes, such a complex principle of mass-energy exchange is nothing more than an extremely simple formula: E=mc2. Simple methods are easier to understand, easier to implement, and easier to maintain. When encountering a problem, give priority to the simplest solution, and only consider complex solutions when the simple solution cannot meet the requirements.
4. Don’t get into trouble. When you encounter obstacles, you might as well stay away from the computer for a while, look at the scenery outside the window, listen to light music, and chat with friends. When I encounter a problem, I play games, and they are extremely violent fighting games. When the part of the brain cells responsible for the game are extremely excited, the part of the brain cells responsible for programming get a full rest. When I start working again, I will find that those problems can now be easily solved.
5. Desire for answers. The history of the development of human natural science is a process of longing for answers. Even if we can only know a small part of the answer, it is worth our efforts. As long as you have firm belief and must find the answer to the question, you will devote energy to exploring. Even if you don't get the answer in the end, you will learn a lot in the process.
6. Communicate more with others. There must be a teacher among us when we are walking together. Maybe in a casual conversation with others, a spark of inspiration can burst out. Go online more and see what other people think about the same issue, which will give you a lot of inspiration.
7. Good programming style. Pay attention to developing good habits. The indentation of the code and the naming rules of variables should always be consistent. Everyone knows how to troubleshoot errors in code, but often ignores troubleshooting comments. Comments are an important part of the program. They can make your code easier to understand. If the code has clearly expressed your thoughts, there is no need to add comments. If the comments are inconsistent with the code, it will be even worse.
8. Resilience and perseverance. This is perhaps the biggest difference between "experts" and ordinary programmers. A good programming is 99 heat and 1 ffee. Masters are not geniuses, they have been honed over countless days and nights. Success can bring us great joy, but the process is extremely boring. You might as well do a test, find a table of prime numbers within 10,000, copy them all, and then check them three times. If you can complete this work without interruption, you can meet this requirement.
Hope these are useful to you.
- Previous article:What to post on social media after getting your hair done?
- Next article:How to talk about yourself in an interview?
- Related articles
- Watch boxing and have a chat during the Spring Festival.
- Talking about stable jobs
- Men never do housework. What can women do to change all this?
- General formula for Christmas photos
- How about the triumph of Dongfeng Citroen? Shopkeeper, please tell me what are the shortcomings.
- What are the short sentences of extreme depression?
- What is the most famous stone lion?
- Mom can't publish a short poem on her birthday.
- Punching in Chongqing's circle of friends
- Who is Princess Qing's best friend?