Пікірлер
@GigaChad-zx9hj
@GigaChad-zx9hj 3 күн бұрын
Thx for this video man....
@mintype
@mintype 2 күн бұрын
No problem!
@MANIKANDAN-fy2ww
@MANIKANDAN-fy2ww 8 күн бұрын
0:24 greater than or equal to
@mintype
@mintype 7 күн бұрын
oh yea thanks
@rishisheth5361
@rishisheth5361 16 күн бұрын
U should get a new mic
@mintype
@mintype 16 күн бұрын
bruh
@mintype
@mintype 16 күн бұрын
YO I just checked idk why it sounds like that
@armenia18yt3
@armenia18yt3 27 күн бұрын
short and simple, thank you
@mintype
@mintype 24 күн бұрын
You're welcome!
@kgoeranotwentyone
@kgoeranotwentyone 2 ай бұрын
Man how can you say simple and easy then use loops
@4ugaming693
@4ugaming693 2 ай бұрын
type mismatch bro
@fathurrahmannursaputra4219
@fathurrahmannursaputra4219 2 ай бұрын
can you create for google gemini ?
@TheMrTuanVu
@TheMrTuanVu 2 ай бұрын
thank you a lot for this video!
@JSR2428
@JSR2428 2 ай бұрын
Why you use that + sign with result?
@mintype
@mintype 7 күн бұрын
the plus makes it so the thing after gets ADDED to the string. so the string starts off with nothing in it and each time it goes through the for loop, one letter from the str string is added to result. (it goes backwards so its reversed.)
@blackscience8208
@blackscience8208 2 ай бұрын
The explanation is very good and easy to understand, i am a teenager and i understood it clearly☺☺
@hosteldays3509
@hosteldays3509 3 ай бұрын
Yes I use my api key but it why the link cgatgpt link is not working
@RealTrueguy64
@RealTrueguy64 3 ай бұрын
tysm!!
@meoconhoccode
@meoconhoccode 3 ай бұрын
free account can't use api :(
@ajeetkumarsingh1302
@ajeetkumarsingh1302 3 ай бұрын
great video man probably shortest programming video i have watched on youtube. i am new to coding how do i excel in this
@mintype
@mintype 7 күн бұрын
just keep coding :) if u dont know what to code go learn something new and maybe some cool ideas will pop into ur head!
@xebex5451
@xebex5451 4 ай бұрын
thanks man!!
@mintype
@mintype 7 күн бұрын
yw
@maksim12233
@maksim12233 4 ай бұрын
why you use swing? you need to use javaFX
@mintype
@mintype 4 ай бұрын
Some people want to learn swing. I can teach both so it’s fine. If I make a JavaFX video I’ll put it in the title.
@thedadbrains
@thedadbrains 4 ай бұрын
you're amazing!
@mintype
@mintype 4 ай бұрын
Wow, thank you!
@giveaway5630
@giveaway5630 5 ай бұрын
Requires GPT-4, because when reading an error message after asking, getting insufficient credits
@mintype
@mintype 4 ай бұрын
It means your openAI account doesn’t have any funds/money left
@oshadhaedirisinghe1455
@oshadhaedirisinghe1455 5 ай бұрын
Thank you
@mintype
@mintype 7 күн бұрын
yw
@baseplate_462
@baseplate_462 5 ай бұрын
im not exactly sure i understand why we do .length - 1; what is the -1 for?
@almira4008
@almira4008 4 ай бұрын
-1 means the index of last character, because index starts from zero, so when you want to get last characters' index you should add this -1
@HorridOnlineTroll
@HorridOnlineTroll 3 ай бұрын
array {1, 2, 3, 4, 5} There's 5 elements inside, it has a length of 5. However, if we want to know the index of each element inside the array the value '1' is at position '0' which means element '5' is at position '4', so to get the value '5' we need to write array[4]. given N is the length of the array, n-1 determins the position of those elements. If simple wrote i = str.length; you would get an out of bounds exception element because the element '5' is at position '4', not position '5'. Following the formular n-1, we say str.-length-1 to ensure we always end up at the last element contained within the array.
@ravalimanchala8170
@ravalimanchala8170 2 ай бұрын
Thank you for your valuable information
@frailedtea
@frailedtea 2 ай бұрын
@@HorridOnlineTroll You're amazing!
@douglassousa9188
@douglassousa9188 5 ай бұрын
Não funcionou
@user-tx6qd8fs1h
@user-tx6qd8fs1h 5 ай бұрын
I think API keys are expired now, so we must pay to run the code? Plz. reply me as fast as you can, i must finish my project in next two weeks
@mintype
@mintype 5 ай бұрын
Yeah you have to pay but its really cheap
@yashbhatt9442
@yashbhatt9442 6 ай бұрын
Will this run in bluej
@mintype
@mintype 6 ай бұрын
If it's java, it's going to work. If it doesn't you most likely forgot to import something.
@hyperkarlotheweeb2969
@hyperkarlotheweeb2969 7 ай бұрын
Thank youuuuu
@mintype
@mintype 6 ай бұрын
Glad to help!
@hudashaikh5169
@hudashaikh5169 9 ай бұрын
i got server 429 error for first time why is it happening
@mintype
@mintype 9 ай бұрын
Check your api key is working and valid. Make sure it is not expired if it is a free trial.
@ajwadshine4638
@ajwadshine4638 9 ай бұрын
Thanks preciate it.
@mintype
@mintype 9 ай бұрын
No problem!
@chrism2828
@chrism2828 10 ай бұрын
I keep getting an exception out of bounds error and I’m not sure why.
@mintype
@mintype 9 ай бұрын
send ur code here
@mathsbigsecrets6100
@mathsbigsecrets6100 10 ай бұрын
I get an "Server returned HTTP response code: 429" Error. I believer the BufferedReader in is what's causing the issue. Any ideas on what might be going wrong?
@mintype
@mintype 10 ай бұрын
Check your api key is valid not expired and works. Also check how much free trial money you have left if you are in the free trial. (Other people have had the same issue before)
@irisrin
@irisrin 10 ай бұрын
my results came out diffrent
@mintype
@mintype 10 ай бұрын
Can you provide some info? Like give me your code so I can see whats wrong. Also maybe tell me your version of Java? New Java versions come out all the time and can break old code. discord help server: discord.gg/hhGu6mV5wm <-----
@kevswags
@kevswags 10 ай бұрын
I think i found an easier way: String s = "123456789"; StringBuilder x = new StringBuilder(s); x.reverse(); String output = x.toString(); System.out.println(output);
@mintype
@mintype 10 ай бұрын
Your way works and is more simple than my way, however this video is supposed to teach those who don’t know how to reverse a sting WITHOUT StringBuilder. (For example in a AP CSA class they would ask you to do this without StringBuilder)
@HorridOnlineTroll
@HorridOnlineTroll 3 ай бұрын
interviews tend to not allow things like StringBuilder, while yes it is more efficient, they want to see if you know the fundamental logic
@proyoloks1386
@proyoloks1386 10 ай бұрын
ah yes, short... thank you :)
@mintype
@mintype 10 ай бұрын
You're welcome! There’s no reason learning something like this should take super long.
@deev3582
@deev3582 10 ай бұрын
Nice tq i got a great java tutorial channel
@mintype
@mintype 10 ай бұрын
Happy to help
@-GordonFreeman
@-GordonFreeman 10 ай бұрын
I asked a chatbot to kill itself so i wanted this to make the suicide seem real
@mintype
@mintype 10 ай бұрын
what
@-GordonFreeman
@-GordonFreeman 10 ай бұрын
@@mintype Thank you, it worked kzfaq.infoFB6--ys9yGM?feature=shared
@ELLIOT-uq8nc
@ELLIOT-uq8nc 10 ай бұрын
YOU SHOULD MAKE MORE VIDEOS BRO
@mintype
@mintype 10 ай бұрын
On what
@ELLIOT-uq8nc
@ELLIOT-uq8nc 10 ай бұрын
on this topic ofc@@mintype
@nahidasultana6842
@nahidasultana6842 11 ай бұрын
Hi, I am having an error. what mistake i have made? package Practice; public class HelloReverse { public static void main(String[] args) { String input ="Hello world!"; String output=" "; for(int i=input.length()-1;i>=0;i--); output+=input.charAt(i); System.out.println(output);
@mintype
@mintype 10 ай бұрын
You have a ; (semicolon) at the end of your for loop!!!! updated code: String input ="Hello world!"; String output=" "; for(int i=input.length()-1;i>=0;i--) output+=input.charAt(i); System.out.println(output);
@nahidasultana6842
@nahidasultana6842 10 ай бұрын
@@mintype Thank you so much!
@ravalimanchala8170
@ravalimanchala8170 2 ай бұрын
Thank you
@ravalimanchala8170
@ravalimanchala8170 2 ай бұрын
Thank you
@ravalimanchala8170
@ravalimanchala8170 2 ай бұрын
Thank you
@debalinaghosh6404
@debalinaghosh6404 11 ай бұрын
when I ask for a java program it is not giving the complete output. Could you help me in this?
@mintype
@mintype 11 ай бұрын
Prompt the API with "continue" after if it is incomplete.
@mintype
@mintype 11 ай бұрын
join the discord! -> discord.gg/hhGu6mV5wm
@mintype
@mintype 11 ай бұрын
join the discord! -> discord.gg/hhGu6mV5wm
@mintype
@mintype 11 ай бұрын
join the discord! -> discord.gg/hhGu6mV5wm
@mintype
@mintype 11 ай бұрын
join the discord! -> discord.gg/hhGu6mV5wm
@mintype
@mintype 11 ай бұрын
join the discord! -> discord.gg/hhGu6mV5wm
@shashivadhangunti3411
@shashivadhangunti3411 11 ай бұрын
where is the code
@mintype
@mintype 11 ай бұрын
Its the pinned comment.
@bankarsandipk
@bankarsandipk Жыл бұрын
Nice short explanation 😊
@mintype
@mintype Жыл бұрын
Glad it was helpful!
@joseangelnavarro4116
@joseangelnavarro4116 Жыл бұрын
I can't get the code to work. Error 429. I have created another user with another key
@mintype
@mintype Жыл бұрын
Error 429 may happen to you if you send too many requests in a short period of time.
@joseangelnavarro4116
@joseangelnavarro4116 Жыл бұрын
@@mintype with a new user and new key if i do the first request the code is it. Is possible any change with free counter politic?
@ece03abhisheksrivastava64
@ece03abhisheksrivastava64 6 ай бұрын
@@mintype Bro even showing 429 for first time call 🤔
@ReeachyZ_
@ReeachyZ_ 4 ай бұрын
​@@mintypein first request this happens
@my__type4
@my__type4 3 ай бұрын
Does anyone solve this problem? I'm having the same issue. I'm using Eclipse IDE
@mintype
@mintype Жыл бұрын
join my discord :) --> discord.gg/hhGu6mV5wm
@user-pu5bm7cj9w
@user-pu5bm7cj9w Жыл бұрын
Hey, how could I get the Java codes? You mentioned that check description, but I failed to find it...
@mintype
@mintype Жыл бұрын
Heres the code (updated): import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.net.HttpURLConnection; import java.net.URL; public class Main { public static void main(String[] args) { System.out.println(chatGPT("hello, how are you?")); // Prints out a response to the question. } public static String chatGPT(String message) { String url = "api.openai.com/v1/chat/completions"; String apiKey = "KEY GOES HERE!!!!!!!!!!!"; // API key goes here String model = "gpt-3.5-turbo"; // current model of chatgpt api try { // Create the HTTP POST request URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Authorization", "Bearer " + apiKey); con.setRequestProperty("Content-Type", "application/json"); // Build the request body String body = "{\"model\": \"" + model + "\", \"messages\": [{\"role\": \"user\", \"content\": \"" + message + "\"}]}"; con.setDoOutput(true); OutputStreamWriter writer = new OutputStreamWriter(con.getOutputStream()); writer.write(body); writer.flush(); writer.close(); // Get the response BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); // returns the extracted contents of the response. return extractContentFromResponse(response.toString()); } catch (IOException e) { throw new RuntimeException(e); } } // This method extracts the response expected from chatgpt and returns it. public static String extractContentFromResponse(String response) { int startMarker = response.indexOf("content")+11; // Marker for where the content starts. int endMarker = response.indexOf("\"", startMarker); // Marker for where the content ends. return response.substring(startMarker, endMarker); // Returns the substring containing only the response. } }
@supercodingandmath2826
@supercodingandmath2826 Жыл бұрын
@@mintype hello
@PokeMichele
@PokeMichele Жыл бұрын
I don't know why it always refuses the connection when i try to execute it
@mintype
@mintype Жыл бұрын
Check if your API free trial has expired yet. Many people get the same issue and don't realize their trial has expired.
@flashu09
@flashu09 Жыл бұрын
how to make a bind like if i pres r start clicking and agin a press r stops clicking ? pls help
@mintype
@mintype Жыл бұрын
One way to do this is to create a GUI with Java Swing or JavaFX. I have a video on swing. Then you can use keyListener to listen for the R key and turn it on or off. However, please take note that the GUI has to be open when you press R on your keyboard. Java doesn't have any way of doing this without the GUI focused. (There are GitHub repositories which might help, but I'm not certain they work!)
@twipie
@twipie Жыл бұрын
Thank you!
@mintype
@mintype Жыл бұрын
You're welcome!
@oroi196
@oroi196 Жыл бұрын
works for me. ty bro
@mintype
@mintype Жыл бұрын
Good to hear
@user-lk4zi8id4p
@user-lk4zi8id4p Жыл бұрын
Hey is it free?