EduLearn - Online Education Platform

Welcome to EduLearn!

Start learning today with our wide range of courses taught by industry experts. Gain new skills, advance your career, or explore new interests.

Browse Courses

Java stack sum of element program

class Customizedstack { private int arr[];//Array to store stack elements private int top; //acts as a cursor for stack private int capacity;//maximum size of stack   Customizedstack(int size)//5 { capacity=size;//5 arr=new int[capacity];//0-4 top=-1; }   public void push(int value)//10 { if(top==capacity-1)//4 { System.out.println(“stack is overflow”); } else { arr[++top]=value; }   }   public int […]

Reversing a string in java

  /*Question 2ú : Reverse Prefix of Word(Using Stack)   Given a 0-indexed string word and a character ch, reverse the segment of word that starts at index 0 and ends at the index of the first occurrence of ch (inclusive). If the character ch does not exist in word, do nothing.ä   For example, […]

Linear data structure in java

import java.util.*; class Stacksearch { public static void main(String args[]) { Stack<String> s=new Stack<>();   //push the elements(inserting elements)   s.push(“Apple”); s.push(“Banana”); s.push(“cherry”);   System.out.println(“the elements are: +s);   String searchelement=”cherry”;   int position=s.search(searchelement);   if(position != -1) { System.out.println(searchelement +”found at the position(from top)” +position); } else { System.out.println(searchelement +”not found inside the stack”); […]

Java stack in data structures

Stack:   A stack is a linear data structure that follows LIFO(LAST IN FIRST OUT) principle   linear data structure–>where elements are arranged in a sequence order. Every elements will be connected to its previous or next element   Task Description   push(item)———————-Adds an item to the top of the stack   pop()—————————Remove and return […]

Java example programs for Reversing each word

1)Reverse each word in a sentence   input: java is fun   output:avaj si nuf   import java.util.*;   class ASC { public static void main(String args[]) { String a=”java is fun”;   String b[]=a.split(” “);//b[java–>0 is–>1 fun–>2]   for(String c:b)//c=fun { StringBuilder s=new StringBuilder(c);//(fun) System.out.print(s.reverse()+” “);//avaj si nuf }     } } ———————————– […]

Java factorial program with example

–>Should be able to define a solution of a problem in terms of solution of similar problems    –>Proper terminating condition Factorial==> 5!=>5x4x3x2x1 5!=5×4! 4!=4x3x2x1 4!=4×3! cimport java.util.*; class ASC {  static int fact(int n)//5   {    if(n==0)     return 1;    else     return n*fact(n-1);   } public static void main(String […]

Java practice questions for learning

import java.util.*;   class ASC { public static void main(String args[]) { Scanner s=new Scanner(System.in); int amount;   while(true) { System.out.println(“enter the amount to withdraw”);//2300 amount=s.nextInt();//2300   if(amount==0) { System.out.println(“exiting…”); break; }   if(amount%100!=0)2300%100==>00!=0 { System.out.println(“Invalid amount…”); }     int a=amount/2000; amount=amount%2000;   int b=amount/500; amount=amount%500;   int c=amount/100; amount=amount%100;   if(a>0) System.out.println(a+”x2000″); if(b>0) […]

Wrapper classes in java

Wrapper classes in java:   A wrapper class in java is a class whose objects wraps or contains primitive datatypes   Need: They convert primitive datatypes into objects   In collection framework, such as Arraylist and sets,will store only objects and not primitive datatypes     Primitive datatypes Wrapper classes   char————————Character int————————-Integer float———————–Float double———————–Double […]

EduLearn - Online Education Platform

Welcome to EduLearn!

Start learning today with our wide range of courses taught by industry experts. Gain new skills, advance your career, or explore new interests.

Browse Courses

Popular Courses

[Course Image]

Introduction to Programming

Learn the fundamentals of programming with Python in this beginner-friendly course.

12 Hours Beginner
[Course Image]

Data Science Essentials

Master the basics of data analysis, visualization, and machine learning.

20 Hours Intermediate
[Course Image]

Web Development Bootcamp

Build modern websites with HTML, CSS, JavaScript and popular frameworks.

30 Hours Beginner
[Course Image]

Digital Marketing Fundamentals

Learn SEO, social media marketing, email campaigns and analytics.

15 Hours Beginner
Educational Website Footer