search
HomeTechnology peripheralsAIOh my god, is ChatGPT really going to work for us?

Oh my god, is ChatGPT really going to work for us?

Apr 13, 2023 am 08:19 AM
businesschatgptcode

​Foreword

ChatGPT​ is really very popular recently, and AI services related to ChatGPT are also being researched in full swing. Today we take a look at the application of ChatGPT in coding. Recently we found an IntelliJ IDEA plug-in called "AI Coding Assistant", which integrates ChatGPT technology. Let's see how smart it is and whether it will really work in the future. It is possible that it will replace the work of our programmers.

Plug-in installation

In order to start using the plug-in, you must have an OpenAI token. If you don't know where to find it, you can get it here https://platform.openai.com/account/api-keys on how to register. Baidu and Google have a lot of tutorials.

In addition, download and install the "AI Coding Assistant" plug-in for IntelliJ IDEA:

Oh my god, is ChatGPT really going to work for us?

Figure 1 - "AI Coding Assistant" plug-in in IntelliJ IDEA settings

Try it

  1. Generate the code to print hello world

The first task is a simple one, which is to let it automatically generate and print hello world code.

Oh my god, is ChatGPT really going to work for us?

  1. Generate a pojo

Now you generate a Person class for me.

Oh my god, is ChatGPT really going to work for us?

  1. Now create a function for me to return the generated list of people

Oh my god, is ChatGPT really going to work for us?

  1. After having the person data , we can implement some simple algorithms, such as finding the oldest person in the list, the minimum/maximum/average age of the people in the list

Oh my god, is ChatGPT really going to work for us?

  1. The interesting part of this is that we can ask to update the existing code. Since I know a better way of writing the same algorithm using the Java Stream API, let's try to make it refactor

Oh my god, is ChatGPT really going to work for us?

  1. We can create a function and ask it to generate code based on the meaning of the function name.​

Oh my god, is ChatGPT really going to work for us?

  1. Then you I also added the javadoc

Oh my god, is ChatGPT really going to work for us?

  1. Can you also add comments to my code and explain what this code does? ?​

Oh my god, is ChatGPT really going to work for us?

  1. Finally, let’s take a look at what the final code generated by this AI plug-in looks like?​
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.IntSummaryStatistics;
import java.util.List;
import java.util.NoSuchElementException;

public class Main {
public static void main(String[] args) {
System.out.println("Hello World");
final List<Person> people = generatePeople();
// find oldest person in the list
Person oldestPerson = people.stream()
.max(Comparator.comparing(Person::getAge))
.orElseThrow(NoSuchElementException::new);
System.out.println("Oldest person is: " + oldestPerson.getName());
// find max,min,avg age of the people
IntSummaryStatistics stats = people.stream()
.mapToInt(Person::getAge)
.summaryStatistics();
System.out.println("Max Age: " + stats.getMax());
System.out.println("Min Age: " + stats.getMin());
System.out.println("Avg Age: " + stats.getAverage());
}

public static List<Person> generatePeople() {
return Arrays.asList(
new Person("John", 25),
new Person("Jane", 30),
new Person("Jack", 20),
new Person("Jill", 35)
);
}

/**
* Capitalizes the first letter of a given string and lowercases the rest.
*
* @param s The string to capitalize
* @return The capitalized string
*/
public static String capitalize(String s) {
/*
This code checks if the length of the string "s" is 0. If it is, it returns the string.
If not, it returns the first character of the string in uppercase and the rest of the characters in lowercase.
*/
if (s.length() == 0)
return s;
return s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase();
}
}

// class Person with name and age
class Person {
private String name;
private int age;

public Person(String name, int age) {
this.name = name;
this.age = age;
}

public String getName() {
return name;
}

public int getAge() {
return age;
}
}

Conclusion

Using AI such as ChatGPT can generate some codes, as shown in the example above, but it is still impossible to face some complex businesses. We can use such tools to help us improve efficiency at work, but don’t worry that they will replace us.

The above is the detailed content of Oh my god, is ChatGPT really going to work for us?. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:51CTO.COM. If there is any infringement, please contact admin@php.cn delete
What is ChatGPT's voice input and voice conversation function? Explaining how to set it up and how to use itWhat is ChatGPT's voice input and voice conversation function? Explaining how to set it up and how to use itMay 12, 2025 pm 05:27 PM

ChatGPT is an innovative AI chatbot developed by OpenAI. It not only has text input, but also features voice input and voice conversation functions, allowing for more natural communication. In this article, we will explain how to set up and use the voice input and voice conversation functions of ChatGPT. Even when you can't take your hands off, ChatGPT responds and responds with audio just by talking to you, which brings great benefits in a variety of situations, such as busy business situations and English conversation practice. A detailed explanation of how to set up the smartphone app and PC, as well as how to use each.

An easy-to-understand explanation of how to use ChatGPT for job hunting and job hunting!An easy-to-understand explanation of how to use ChatGPT for job hunting and job hunting!May 12, 2025 pm 05:26 PM

The shortcut to success! Effective job change strategies using ChatGPT In today's intensifying job change market, effective information gathering and thorough preparation are key to success. Advanced language models like ChatGPT are powerful weapons for job seekers. In this article, we will explain how to effectively utilize ChatGPT to improve your job hunting efficiency, from self-analysis to application documents and interview preparation. Save time and learn techniques to showcase your strengths to the fullest, and help you make your job search a success. table of contents Examples of job hunting using ChatGPT Efficiency in self-analysis: Chat

An easy-to-understand explanation of how to create and output mind maps using ChatGPT!An easy-to-understand explanation of how to create and output mind maps using ChatGPT!May 12, 2025 pm 05:22 PM

Mind maps are useful tools for organizing information and coming up with ideas, but creating them can take time. Using ChatGPT can greatly streamline this process. This article will explain in detail how to easily create mind maps using ChatGPT. Furthermore, through actual examples of creation, we will introduce how to use mind maps on various themes. Learn how to effectively organize and visualize your ideas and information using ChatGPT. OpenAI's latest AI agent, OpenA

ChatGPT can be used for commercial purposes! Explaining copyright and terms of cautionChatGPT can be used for commercial purposes! Explaining copyright and terms of cautionMay 12, 2025 pm 05:21 PM

ChatGPT: Business use and thorough explanations Many people are probably thinking about using ChatGPT in their business. This AI model provided by OpenAI is permitted for commercial use under certain rules. In this article, we will explain in detail the points to note when using ChatGPT for commercial use, based on OpenAI's terms of use. While we can expect to improve productivity and create new business opportunities, measures against risks are also essential. Through this article, you will deepen your understanding of the commercial use of ChatGPT and learn how to use it safely and effectively.

A thorough comparison of ChatGPT pricing plans! Differences and how to choose between free and paid versions [Latest 2025]A thorough comparison of ChatGPT pricing plans! Differences and how to choose between free and paid versions [Latest 2025]May 12, 2025 pm 05:20 PM

ChatGPT Price Plans Thorough Guide: 2025 Latest Edition ChatGPT is an AI chatbot that offers a variety of pricing plans. Are you wondering which one to choose, from the free version to the company? This article will explain in an easy-to-understand manner the pricing structure for the latest 2025 edition and the differences between each plan. Let's take a closer look at the features, prices, eligible users, and API fees for the free version, Plus, Pro, Team, and Enterprise plans. table of contents ChatGPT Pricing Plan Overview What is ChatGPT? ChatGPT Fees

A thorough explanation of how to use ChatGPT for interview practice and preparation and prompts!A thorough explanation of how to use ChatGPT for interview practice and preparation and prompts!May 12, 2025 pm 05:16 PM

Effective interview preparation using ChatGPT: a step-by-step guide In this article, we will explain how to use OpenAI's conversational AI assistant, ChatGPT, to step-by-step interview preparation. Through dialogue with ChatGPT, we cover everything from creating interview questions, deriving the best answers, and conducting mock interviews. Get confident in your interview with effective interview preparation using AI. Is it possible to prepare for an interview with ChatGPT? ChatGPT is an AI that generates natural dialogue. Excellent in answering questions and writing texts, and is also extremely useful for preparing interviews.

What is ChatGPT Plus? A thorough explanation of the features, differences from the free version, and the pricing structure!What is ChatGPT Plus? A thorough explanation of the features, differences from the free version, and the pricing structure!May 12, 2025 pm 05:15 PM

The success of AI has become increasingly remarkable in modern society, and the ChatGPT provided by OpenAI is attracting attention. In particular, the advanced paid version of ChatGPT Plus has a reputation for being more functional than the free version of ChatGPT and is more convenient for users. In this article, we will explain in an easy-to-understand manner the differences between ChatGPT and ChatGPT Plus, as well as the advantages and disadvantages of using ChatGPT Plus. In addition to advanced features such as image generation, plugins, and multimodal support, it also meets your needs.

[Free AI] How to personify pets and animals with ChatGPT? Explanation[Free AI] How to personify pets and animals with ChatGPT? ExplanationMay 12, 2025 pm 05:13 PM

Make your pet personified characters with the AI ​​you use! Easy creation and copyright measures with ChatGPT "Pet personification" is a hot topic on social media. In fact, it can be easily achieved using OpenAI's ChatGPT (GPT-4o)! In this article, we will explain in an easy-to-understand manner how to create a pet personified character using ChatGPT, with examples of prompts. Furthermore, we provide detailed explanations on copyright and usage precautions, so you can work on creative activities with confidence. For more information about the latest API model, "GPT-4.1," please see here. [ChatGPT 4.1 (GPT-4.1) Explanation

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool